Package org.apache.cayenne.exp.property
Class PropertyFactory
java.lang.Object
org.apache.cayenne.exp.property.PropertyFactory
Factory class that produces all property types.
- Since:
- 4.2
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final NumericProperty<Long>Property that can be used to selectCOUNT(*)static final DateProperty<LocalDateTime>Property that corresponds to SQL functionNOW()
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> BaseProperty<T>createBase(String name, Class<T> type) Create base propertystatic <T> BaseProperty<T>createBase(String name, Expression expression, Class<T> type) Create base propertystatic <T> BaseProperty<T>createBase(Expression expression, Class<T> type) Create base propertystatic <T> BaseProperty<T>createBase(CayennePath path, Class<T> type) Create base propertystatic <T> BaseProperty<T>createBase(CayennePath path, Expression expression, Class<T> type) Create base propertystatic <T> BaseIdProperty<T>createBaseId(String attribute, String entityName, Class<T> propertyType) static <T> BaseIdProperty<T>createBaseId(String attribute, String path, String entityName, Class<T> propertyType) static <T> BaseIdProperty<T>createBaseId(String attribute, CayennePath path, String entityName, Class<T> propertyType) Create property that represents base IDstatic <T> DateProperty<T>createDate(String name, Class<T> type) Create date propertystatic <T> DateProperty<T>createDate(String name, Expression expression, Class<T> type) Create date propertystatic <T> DateProperty<T>createDate(Expression expression, Class<T> type) Create date propertystatic <T> DateProperty<T>createDate(CayennePath path, Class<T> type) Create date propertystatic <T> DateProperty<T>createDate(CayennePath path, Expression expression, Class<T> type) Create date propertystatic <T extends EmbeddableObject>
 EmbeddableProperty<T>createEmbeddable(String name, Class<T> embeddableType) Create property that represents embeddablestatic <T extends EmbeddableObject>
 EmbeddableProperty<T>createEmbeddable(String name, Expression exp, Class<T> embeddableType) Create property that represents embeddablestatic <T extends EmbeddableObject>
 EmbeddableProperty<T>createEmbeddable(CayennePath path, Class<T> embeddableType) Create property that represents embeddablestatic <T extends EmbeddableObject>
 EmbeddableProperty<T>createEmbeddable(CayennePath path, Expression exp, Class<T> embeddableType) Create property that represents embeddablestatic <T extends Persistent>
 EntityProperty<T>createEntity(String name, Class<T> type) Create entity propertystatic <T extends Persistent>
 EntityProperty<T>createEntity(String name, Expression expression, Class<T> entityType) Create entity propertystatic <T extends Persistent>
 EntityProperty<T>createEntity(Expression expression, Class<T> type) Create entity propertystatic <T extends Persistent>
 EntityProperty<T>createEntity(CayennePath path, Class<T> type) Create entity propertystatic <T extends Persistent>
 EntityProperty<T>createEntity(CayennePath path, Expression expression, Class<T> entityType) Create entity propertystatic <T extends Persistent>
 ListProperty<T>createList(String name, Class<T> entityType) Create to-many relationship mapped on list propertystatic <T extends Persistent>
 ListProperty<T>createList(String name, Expression expression, Class<T> entityType) Create to-many relationship mapped on list propertystatic <T extends Persistent>
 ListProperty<T>createList(CayennePath path, Class<T> entityType) Create to-many relationship mapped on list propertystatic <T extends Persistent>
 ListProperty<T>createList(CayennePath path, Expression expression, Class<T> entityType) Create to-many relationship mapped on list propertystatic <K,V extends Persistent> 
 MapProperty<K,V> Create to-many relationship mapped on map propertystatic <K,V extends Persistent> 
 MapProperty<K,V> createMap(String name, Expression expression, Class<K> keyType, Class<V> entityType) Create to-many relationship mapped on map propertystatic <K,V extends Persistent> 
 MapProperty<K,V> createMap(CayennePath path, Class<K> keyType, Class<V> entityType) Create to-many relationship mapped on map propertystatic <K,V extends Persistent> 
 MapProperty<K,V> createMap(CayennePath path, Expression expression, Class<K> keyType, Class<V> entityType) Create to-many relationship mapped on map propertystatic <T extends Number>
 NumericProperty<T>createNumeric(String name, Class<T> type) Create numeric propertystatic <T extends Number>
 NumericProperty<T>createNumeric(String name, Expression expression, Class<T> type) Create numeric propertystatic <T extends Number>
 NumericProperty<T>createNumeric(Expression expression, Class<T> type) Create numeric propertystatic <T extends Number>
 NumericProperty<T>createNumeric(CayennePath path, Expression expression, Class<T> type) Create numeric propertystatic <T extends Number>
 NumericIdProperty<T>createNumericId(String attribute, String entityName, Class<T> propertyType) static <T extends Number>
 NumericIdProperty<T>createNumericId(String attribute, String path, String entityName, Class<T> propertyType) static <T extends Number>
 NumericIdProperty<T>createNumericId(String attribute, CayennePath path, String entityName, Class<T> propertyType) static <T extends Persistent>
 SelfProperty<T>createSelf(Class<T> type) Self property allows to create column queries that return full objects along with custom column set.static <T extends Persistent>
 EntityProperty<T>createSelf(Expression expression, Class<T> type) Self property allows to create column queries that return full objects along with custom column set.static <T extends Persistent>
 SetProperty<T>Create to-many relationship mapped on set propertystatic <T extends Persistent>
 SetProperty<T>createSet(String name, Expression expression, Class<T> entityType) Create to-many relationship mapped on set propertystatic <T extends Persistent>
 SetProperty<T>createSet(CayennePath path, Class<T> entityType) Create to-many relationship mapped on set propertystatic <T extends Persistent>
 SetProperty<T>createSet(CayennePath path, Expression expression, Class<T> entityType) Create to-many relationship mapped on set propertystatic <T extends CharSequence>
 StringProperty<T>createString(String name, Class<T> type) Create string propertystatic <T extends CharSequence>
 StringProperty<T>createString(String name, Expression expression, Class<T> type) Create string propertystatic <T extends CharSequence>
 StringProperty<T>createString(Expression expression, Class<T> type) Create string propertystatic <T extends CharSequence>
 StringProperty<T>createString(CayennePath path, Class<T> type) Create string propertystatic <T extends CharSequence>
 StringProperty<T>createString(CayennePath path, Expression expression, Class<T> type) Create string property
- 
Field Details- 
COUNTProperty that can be used to selectCOUNT(*)Usage: ObjectSelect.columnQuery(Artist.class, Artist.ARTIST_NAME, PropertyFactory.COUNT);- See Also:
 
- 
NOWProperty that corresponds to SQL functionNOW()Usage: ObjectSelect.query(Artist.class).where(Artist.DATE_OF_BIRTH.year().lt(PropertyFactory.NOW.year().sub(100)));
 
- 
- 
Constructor Details- 
PropertyFactorypublic PropertyFactory()
 
- 
- 
Method Details- 
createBaseCreate base property- Type Parameters:
- T- type of represented attribute
- Parameters:
- name- of the property
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression
 
- 
createBasepublic static <T> BaseProperty<T> createBase(CayennePath path, Expression expression, Class<T> type) Create base property- Type Parameters:
- T- type of represented attribute
- Parameters:
- path- of the property
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression
- Since:
- 5.0
 
- 
createBaseCreate base property- Type Parameters:
- T- type of represented attribute
- Parameters:
- name- of the property, will be used as value for path expression
- type- type of represented attribute
- Returns:
- new path property
 
- 
createBaseCreate base property- Type Parameters:
- T- type of represented attribute
- Parameters:
- path- of the property, will be used as value for path expression
- type- type of represented attribute
- Returns:
- new path property
- Since:
- 5.0
 
- 
createBaseCreate base property- Type Parameters:
- T- type of represented attribute
- Parameters:
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression without name
 
- 
createStringpublic static <T extends CharSequence> StringProperty<T> createString(CayennePath path, Expression expression, Class<T> type) Create string property- Type Parameters:
- T- type of represented attribute
- Parameters:
- path- of the property
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression
- Since:
- 5.0
 
- 
createStringpublic static <T extends CharSequence> StringProperty<T> createString(String name, Expression expression, Class<T> type) Create string property- Type Parameters:
- T- type of represented attribute
- Parameters:
- name- of the property
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression
 
- 
createStringpublic static <T extends CharSequence> StringProperty<T> createString(CayennePath path, Class<T> type) Create string property- Type Parameters:
- T- type of represented attribute
- Parameters:
- path- of the property, will be used as value for path expression
- type- type of represented attribute
- Returns:
- new path property
- Since:
- 5.0
 
- 
createStringCreate string property- Type Parameters:
- T- type of represented attribute
- Parameters:
- name- of the property, will be used as value for path expression
- type- type of represented attribute
- Returns:
- new path property
 
- 
createStringpublic static <T extends CharSequence> StringProperty<T> createString(Expression expression, Class<T> type) Create string property- Type Parameters:
- T- type of represented attribute
- Parameters:
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression without name
 
- 
createNumericpublic static <T extends Number> NumericProperty<T> createNumeric(CayennePath path, Expression expression, Class<T> type) Create numeric property- Type Parameters:
- T- type of represented attribute
- Parameters:
- path- of the property
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression
- Since:
- 5.0
 
- 
createNumericpublic static <T extends Number> NumericProperty<T> createNumeric(String name, Expression expression, Class<T> type) Create numeric property- Type Parameters:
- T- type of represented attribute
- Parameters:
- name- of the property
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression
 
- 
createNumericCreate numeric property- Type Parameters:
- T- type of represented attribute
- Parameters:
- name- of the property, will be used as value for path expression
- type- type of represented attribute
- Returns:
- new path property
 
- 
createNumericpublic static <T extends Number> NumericProperty<T> createNumeric(Expression expression, Class<T> type) Create numeric property- Type Parameters:
- T- type of represented attribute
- Parameters:
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression without name
 
- 
createDatepublic static <T> DateProperty<T> createDate(CayennePath path, Expression expression, Class<T> type) Create date property- Type Parameters:
- T- type of represented attribute
- Parameters:
- path- of the property
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression
- Since:
- 5.0
 
- 
createDateCreate date property- Type Parameters:
- T- type of represented attribute
- Parameters:
- name- of the property
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression
 
- 
createDateCreate date property- Type Parameters:
- T- type of represented attribute
- Parameters:
- path- of the property, will be used as value for path expression
- type- type of represented attribute
- Returns:
- new path property
- Since:
- 5.0
 
- 
createDateCreate date property- Type Parameters:
- T- type of represented attribute
- Parameters:
- name- of the property, will be used as value for path expression
- type- type of represented attribute
- Returns:
- new path property
 
- 
createDateCreate date property- Type Parameters:
- T- type of represented attribute
- Parameters:
- expression- that property will use
- type- type of represented attribute
- Returns:
- new property with custom expression without name
 
- 
createEntitypublic static <T extends Persistent> EntityProperty<T> createEntity(CayennePath path, Expression expression, Class<T> entityType) Create entity property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- path- of the property
- expression- that property will use
- entityType- type of represented relationship entity
- Returns:
- new property with custom expression
- Since:
- 5.0
 
- 
createEntitypublic static <T extends Persistent> EntityProperty<T> createEntity(String name, Expression expression, Class<T> entityType) Create entity property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- name- of the property
- expression- that property will use
- entityType- type of represented relationship entity
- Returns:
- new property with custom expression
 
- 
createEntitypublic static <T extends Persistent> EntityProperty<T> createEntity(CayennePath path, Class<T> type) Create entity property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- path- of the property, will be used as value for path expression
- type- type of represented relationship entity
- Returns:
- new path property
- Since:
- 5.0
 
- 
createEntityCreate entity property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- name- of the property, will be used as value for path expression
- type- type of represented relationship entity
- Returns:
- new path property
 
- 
createEntitypublic static <T extends Persistent> EntityProperty<T> createEntity(Expression expression, Class<T> type) Create entity property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- expression- that property will use
- type- type of represented relationship entity
- Returns:
- new property with custom expression without name
 
- 
createSelfSelf property allows to create column queries that return full objects along with custom column set.Usage example, query will return object with dependent objects count: List<Object[]> result = ObjectSelect.columnQuery(Artist.class, PropertyFactory.createSelf(Artist.class), Artist.PAINTING_ARRAY.count()) .select(context);- Type Parameters:
- T- type of represented entity
- Parameters:
- type- of represented entity
- Returns:
- new 'self' property
 
- 
createSelfpublic static <T extends Persistent> EntityProperty<T> createSelf(Expression expression, Class<T> type) Self property allows to create column queries that return full objects along with custom column set.This method is not much useful, as to-one property can be used as is in this case, example is purely for demonstration purpose only. See EntityPropertyusage examples.Usage example, query will return object with dependent objects count: List<Object[]> result = ObjectSelect.columnQuery(Painting.class, Painting.PAINTING_TITLE, PropertyFactory.createSelf(Painting.TO_ARTIST.getExpression(), Painting.class)) .select(context);- Type Parameters:
- T- type of represented entity
- Parameters:
- expression- expression to be used for this property (usually it will be path from other property)
- type- of represented entity
- Returns:
- new 'self' property
 
- 
createListpublic static <T extends Persistent> ListProperty<T> createList(CayennePath path, Expression expression, Class<T> entityType) Create to-many relationship mapped on list property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- path- of the property
- expression- that property will use
- entityType- type of represented relationship entity
- Returns:
- new property with custom expression
- Since:
- 5.0
 
- 
createListpublic static <T extends Persistent> ListProperty<T> createList(String name, Expression expression, Class<T> entityType) Create to-many relationship mapped on list property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- name- of the property
- expression- that property will use
- entityType- type of represented relationship entity
- Returns:
- new property with custom expression
 
- 
createListpublic static <T extends Persistent> ListProperty<T> createList(CayennePath path, Class<T> entityType) Create to-many relationship mapped on list property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- path- of the property, will be used as value for path expression
- entityType- type of represented relationship entity
- Returns:
- new path property
- Since:
- 5.0
 
- 
createListCreate to-many relationship mapped on list property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- name- of the property, will be used as value for path expression
- entityType- type of represented relationship entity
- Returns:
- new path property
 
- 
createSetpublic static <T extends Persistent> SetProperty<T> createSet(CayennePath path, Expression expression, Class<T> entityType) Create to-many relationship mapped on set property- Type Parameters:
- T- type of represented attribute
- Parameters:
- path- of the property
- expression- that property will use
- entityType- type of represented attribute
- Returns:
- new property with custom expression
- Since:
- 5.0
 
- 
createSetpublic static <T extends Persistent> SetProperty<T> createSet(String name, Expression expression, Class<T> entityType) Create to-many relationship mapped on set property- Type Parameters:
- T- type of represented attribute
- Parameters:
- name- of the property
- expression- that property will use
- entityType- type of represented attribute
- Returns:
- new property with custom expression
 
- 
createSetpublic static <T extends Persistent> SetProperty<T> createSet(CayennePath path, Class<T> entityType) Create to-many relationship mapped on set property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- path- of the property, will be used as value for path expression
- entityType- type of represented relationship entity
- Returns:
- new path property
- Since:
- 5.0
 
- 
createSetCreate to-many relationship mapped on set property- Type Parameters:
- T- type of represented relationship entity
- Parameters:
- name- of the property, will be used as value for path expression
- entityType- type of represented relationship entity
- Returns:
- new path property
 
- 
createMappublic static <K,V extends Persistent> MapProperty<K,V> createMap(CayennePath path, Expression expression, Class<K> keyType, Class<V> entityType) Create to-many relationship mapped on map property- Type Parameters:
- K- type of represented relationship keys
- V- type of represented relationship values
- Parameters:
- path- of the property
- expression- that property will use
- keyType- type of represented relationship keys
- entityType- type of represented relationship values
- Returns:
- new property with custom expression
- Since:
- 5.0
 
- 
createMappublic static <K,V extends Persistent> MapProperty<K,V> createMap(String name, Expression expression, Class<K> keyType, Class<V> entityType) Create to-many relationship mapped on map property- Type Parameters:
- K- type of represented relationship keys
- V- type of represented relationship values
- Parameters:
- name- of the property
- expression- that property will use
- keyType- type of represented relationship keys
- entityType- type of represented relationship values
- Returns:
- new property with custom expression
 
- 
createMappublic static <K,V extends Persistent> MapProperty<K,V> createMap(CayennePath path, Class<K> keyType, Class<V> entityType) Create to-many relationship mapped on map property- Type Parameters:
- K- type of represented relationship keys
- V- type of represented relationship values
- Parameters:
- path- of the property, will be used as value for path expression
- keyType- type of represented relationship keys
- entityType- type of represented relationship values
- Returns:
- new path property
- Since:
- 5.0
 
- 
createMappublic static <K,V extends Persistent> MapProperty<K,V> createMap(String name, Class<K> keyType, Class<V> entityType) Create to-many relationship mapped on map property- Type Parameters:
- K- type of represented relationship keys
- V- type of represented relationship values
- Parameters:
- name- of the property, will be used as value for path expression
- keyType- type of represented relationship keys
- entityType- type of represented relationship values
- Returns:
- new path property
 
- 
createEmbeddablepublic static <T extends EmbeddableObject> EmbeddableProperty<T> createEmbeddable(CayennePath path, Expression exp, Class<T> embeddableType) Create property that represents embeddable- Type Parameters:
- T- type of represented embeddable entity
- Parameters:
- path- of the property, will be used as value for path expression
- exp- that property will use
- embeddableType- type of represented embeddable entity
- Returns:
- new path property
- Since:
- 5.0
 
- 
createEmbeddablepublic static <T extends EmbeddableObject> EmbeddableProperty<T> createEmbeddable(String name, Expression exp, Class<T> embeddableType) Create property that represents embeddable- Type Parameters:
- T- type of represented embeddable entity
- Parameters:
- name- of the property, will be used as value for path expression
- exp- that property will use
- embeddableType- type of represented embeddable entity
- Returns:
- new path property
 
- 
createEmbeddablepublic static <T extends EmbeddableObject> EmbeddableProperty<T> createEmbeddable(CayennePath path, Class<T> embeddableType) Create property that represents embeddable- Type Parameters:
- T- type of represented embeddable entity
- Parameters:
- path- of the property, will be used as value for path expression
- embeddableType- type of represented embeddable entity
- Returns:
- new path property
- Since:
- 5.0
 
- 
createEmbeddablepublic static <T extends EmbeddableObject> EmbeddableProperty<T> createEmbeddable(String name, Class<T> embeddableType) Create property that represents embeddable- Type Parameters:
- T- type of represented embeddable entity
- Parameters:
- name- of the property, will be used as value for path expression
- embeddableType- type of represented embeddable entity
- Returns:
- new path property
 
- 
createBaseIdpublic static <T> BaseIdProperty<T> createBaseId(String attribute, CayennePath path, String entityName, Class<T> propertyType) Create property that represents base ID- Type Parameters:
- T- type of the represented id
- Parameters:
- attribute- PK attribute name
- path- path of the property
- entityName- entity name
- propertyType- type of the property
- Returns:
- new id property
- Since:
- 5.0
 
- 
createBaseIdpublic static <T> BaseIdProperty<T> createBaseId(String attribute, String path, String entityName, Class<T> propertyType) 
- 
createBaseIdpublic static <T> BaseIdProperty<T> createBaseId(String attribute, String entityName, Class<T> propertyType) 
- 
createNumericIdpublic static <T extends Number> NumericIdProperty<T> createNumericId(String attribute, CayennePath path, String entityName, Class<T> propertyType) 
- 
createNumericIdpublic static <T extends Number> NumericIdProperty<T> createNumericId(String attribute, String entityName, Class<T> propertyType) 
- 
createNumericId
 
-