001package io.ebean.plugin;
002
003import io.ebean.bean.EntityBean;
004import io.ebean.text.StringParser;
005
006/**
007 * A dot notation expression path.
008 */
009public interface ExpressionPath {
010
011  /**
012   * Return true if there is a property on the path that is a many property.
013   */
014  boolean containsMany();
015
016  /**
017   * Return the value from a given entity bean.
018   */
019  Object pathGet(Object bean);
020
021  /**
022   * Set a value to the bean for this expression path.
023   *
024   * @param bean  the bean to set the value on
025   * @param value the value to set
026   */
027  void pathSet(Object bean, Object value);
028
029  /**
030   * Convert the value to the expected type.
031   * <p>
032   * Typically useful for converting strings to the appropriate number type etc.
033   * </p>
034   */
035  Object convert(Object value);
036
037  /**
038   * Return the default StringParser for the scalar property.
039   */
040  StringParser getStringParser();
041
042  /**
043   * For DateTime capable scalar types convert the long systemTimeMillis into
044   * an appropriate java time (Date,Timestamp,Time,Calendar, JODA type etc).
045   */
046  Object parseDateTime(long systemTimeMillis);
047
048  /**
049   * Return true if the last type is "DateTime capable" - can support
050   * {@link #parseDateTime(long)}.
051   */
052  boolean isDateTimeCapable();
053
054  /**
055   * Return the underlying JDBC type or 0 if this is not a scalar type.
056   */
057  int getJdbcType();
058
059  /**
060   * Return true if this is an ManyToOne or OneToOne associated bean property.
061   */
062  boolean isAssocId();
063
064  /**
065   * Return the Id expression string.
066   * <p>
067   * Typically used to produce id = ? expression strings.
068   * </p>
069   */
070  String getAssocIdExpression(String propName, String bindOperator);
071
072  /**
073   * Return the Id values for the given bean value.
074   */
075  Object[] getAssocIdValues(EntityBean bean);
076
077  /**
078   * Return the underlying bean property.
079   */
080  Property getProperty();
081
082  /**
083   * The ElPrefix plus name.
084   */
085  String getElName();
086}