001package com.avaje.ebean.plugin;
002
003import com.avaje.ebean.text.StringParser;
004
005/**
006 * A dot notation expression path.
007 */
008public interface ExpressionPath {
009
010  /**
011   * Return true if there is a property on the path that is a many property.
012   */
013  boolean containsMany();
014
015  /**
016   * Return the value from a given entity bean.
017   */
018  Object pathGet(Object bean);
019
020  /**
021   * Set a value to the bean for this expression path.
022   *
023   * @param bean  the bean to set the value on
024   * @param value the value to set
025   */
026  void pathSet(Object bean, Object value);
027
028  /**
029   * Convert the value to the expected type.
030   * <p>
031   * Typically useful for converting strings to the appropriate number type etc.
032   * </p>
033   */
034  Object convert(Object value);
035
036  /**
037   * Return the default StringParser for the scalar property.
038   */
039  StringParser getStringParser();
040
041  /**
042   * For DateTime capable scalar types convert the long systemTimeMillis into
043   * an appropriate java time (Date,Timestamp,Time,Calendar, JODA type etc).
044   */
045  Object parseDateTime(long systemTimeMillis);
046
047  /**
048   * Return true if the last type is "DateTime capable" - can support
049   * {@link #parseDateTime(long)}.
050   */
051  boolean isDateTimeCapable();
052
053  /**
054   * Return the underlying JDBC type or 0 if this is not a scalar type.
055   */
056  int getJdbcType();
057}