Class PathBuilder<T>

Type Parameters:
T - expression type
All Implemented Interfaces:
EntityPath<T>, Expression<T>, Path<T>, Serializable

public class PathBuilder<T> extends EntityPathBase<T>
PathBuilder is an extension to EntityPathBase for dynamic path construction

Usage example:


 PathBuilder<User> user = new PathBuilder<User>(User.class, "user");
 Predicate filter = user.getString("firstName").eq("Bob");
 List<User> users = query.from(user).where(filter).select(user).fetch();
 
Author:
tiwe
See Also:
  • Constructor Details

    • PathBuilder

      public PathBuilder(Class<? extends T> type, PathMetadata pathMetadata, PathBuilderValidator validator)
      Creates a new PathBuilder instance
      Parameters:
      type - type of the expression
      pathMetadata - path metadata
      validator - validator for property creation
    • PathBuilder

      public PathBuilder(Class<? extends T> type, PathMetadata pathMetadata)
      Creates a new PathBuilder instance
      Parameters:
      type - type of the expression
      pathMetadata - path metadata
    • PathBuilder

      public PathBuilder(Class<? extends T> type, String variable, PathBuilderValidator validator)
      Creates a new PathBuilder instance
      Parameters:
      type - type of the expression
      variable - variable name
      validator - validator for property creation
    • PathBuilder

      public PathBuilder(Class<? extends T> type, String variable)
      Creates a new PathBuilder instance
      Parameters:
      type - type of the expression
      variable - variable name
  • Method Details

    • validate

      protected <A> Class<? extends A> validate(String property, Class<A> propertyType)
    • getMetadata

      public Object getMetadata(Path<?> property)
      Description copied from interface: EntityPath
      Returns additional metadata for the given property path or null if none is available
      Specified by:
      getMetadata in interface EntityPath<T>
      Overrides:
      getMetadata in class EntityPathBase<T>
      Parameters:
      property - property path
      Returns:
      metadata for property or null
    • get

      public PathBuilder<Object> get(String property)
      Create a PathBuilder instance for the given property
      Parameters:
      property - property name
      Returns:
      property path
    • get

      public <A> PathBuilder<A> get(String property, Class<A> type)
      Create a PathBuilder for the given property with the given type
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • getArray

      public <A, E> ArrayPath<A,E> getArray(String property, Class<A> type)
      Create a ArrayPath instance for the given property and the given array type
      Type Parameters:
      A -
      E -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • get

      public BooleanPath get(BooleanPath path)
      Create a new Boolean typed path
      Parameters:
      path - existing path
      Returns:
      property path
    • getBoolean

      public BooleanPath getBoolean(String propertyName)
      Create a new Boolean typed path
      Parameters:
      propertyName - property name
      Returns:
      property path
    • getCollection

      public <A> CollectionPath<A,PathBuilder<A>> getCollection(String property, Class<A> type)
      Create a new Collection typed path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • getCollection

      public <A, E extends SimpleExpression<A>> CollectionPath<A,E> getCollection(String property, Class<A> type, Class<? super E> queryType)
      Create a new Collection typed path
      Type Parameters:
      A -
      E -
      Parameters:
      property - property name
      type - property type
      queryType - expression type
      Returns:
      property path
    • get

      public <A extends Comparable<?>> ComparablePath<A> get(ComparablePath<A> path)
      Create a new Comparable typed path
      Type Parameters:
      A -
      Parameters:
      path - existing path
      Returns:
      property path
    • getComparable

      public <A extends Comparable<?>> ComparablePath<A> getComparable(String property, Class<A> type)
      Create a new Comparable typed path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • get

      public <A extends Comparable<?>> DatePath<A> get(DatePath<A> path)
      Create a new Date path
      Type Parameters:
      A -
      Parameters:
      path - existing path
      Returns:
      property path
    • getDate

      public <A extends Comparable<?>> DatePath<A> getDate(String property, Class<A> type)
      Create a new Date path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • get

      public <A extends Comparable<?>> DateTimePath<A> get(DateTimePath<A> path)
      Create a new DateTime path
      Type Parameters:
      A -
      Parameters:
      path - existing path
      Returns:
      property path
    • getDateTime

      public <A extends Comparable<?>> DateTimePath<A> getDateTime(String property, Class<A> type)
      Create a new DateTime path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • getEnum

      public <A extends Enum<A>> EnumPath<A> getEnum(String property, Class<A> type)
      Create a new Enum path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • get

      public <A extends Enum<A>> EnumPath<A> get(EnumPath<A> path)
      Create a new Enum path
      Type Parameters:
      A -
      Parameters:
      path - existing path
      Returns:
      property path
    • getList

      public <A> ListPath<A,PathBuilder<A>> getList(String property, Class<A> type)
      Create a new List typed path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • getList

      public <A, E extends SimpleExpression<A>> ListPath<A,E> getList(String property, Class<A> type, Class<? super E> queryType)
      Create a new List typed path
      Type Parameters:
      A -
      E -
      Parameters:
      property - property name
      type - property type
      queryType - expression type
      Returns:
      property path
    • getMap

      public <K, V> MapPath<K,V,PathBuilder<V>> getMap(String property, Class<K> key, Class<V> value)
      Create a new Map typed path
      Type Parameters:
      K -
      V -
      Parameters:
      property - property name
      key - key type
      value - value type
      Returns:
      property path
    • getMap

      public <K, V, E extends SimpleExpression<V>> MapPath<K,V,E> getMap(String property, Class<K> key, Class<V> value, Class<? super E> queryType)
      Create a new Map typed path
      Type Parameters:
      K -
      V -
      E -
      Parameters:
      property - property name
      key - key type
      value - value type
      queryType - vaue expression type
      Returns:
      property path
    • get

      public <A extends Number & Comparable<?>> NumberPath<A> get(NumberPath<A> path)
      Create a new Number typed path
      Type Parameters:
      A -
      Parameters:
      path - existing path
      Returns:
      property path
    • getNumber

      public <A extends Number & Comparable<?>> NumberPath<A> getNumber(String property, Class<A> type)
      Create a new Number typed path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • getSet

      public <A> SetPath<A,PathBuilder<A>> getSet(String property, Class<A> type)
      Create a new Set typed path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • getSet

      public <A, E extends SimpleExpression<A>> SetPath<A,E> getSet(String property, Class<A> type, Class<? super E> queryType)
      Create a new Set typed path
      Type Parameters:
      A -
      E -
      Parameters:
      property - property name
      type - property type
      queryType - expression type
      Returns:
      property path
    • get

      public <A> SimplePath<A> get(Path<A> path)
      Create a new Simple path
      Type Parameters:
      A -
      Parameters:
      path - existing path
      Returns:
      property path
    • getSimple

      public <A> SimplePath<A> getSimple(String property, Class<A> type)
      Create a new Simple path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path
    • get

      public StringPath get(StringPath path)
      Create a new String typed path
      Parameters:
      path - existing path
      Returns:
      property path
    • getString

      public StringPath getString(String property)
      Create a new String typed path
      Parameters:
      property - property name
      Returns:
      property path
    • get

      public <A extends Comparable<?>> TimePath<A> get(TimePath<A> path)
      Create a new Time typed path
      Type Parameters:
      A -
      Parameters:
      path - existing path
      Returns:
      property path
    • getTime

      public <A extends Comparable<?>> TimePath<A> getTime(String property, Class<A> type)
      Create a new Time typed path
      Type Parameters:
      A -
      Parameters:
      property - property name
      type - property type
      Returns:
      property path