Class PropertyFactory

    • Field Detail

      • NOW

        public static final DateProperty<LocalDateTime> NOW
        Property that corresponds to SQL function NOW()

        Usage:

        
         ObjectSelect.query(Artist.class).where(Artist.DATE_OF_BIRTH.year().lt(PropertyFactory.NOW.year().sub(100)));
         
    • Constructor Detail

      • PropertyFactory

        public PropertyFactory()
    • Method Detail

      • createBase

        public static <T> BaseProperty<T> createBase​(String name,
                                                     Expression expression,
                                                     Class<T> type)
        Create 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
      • createBase

        public static <T> BaseProperty<T> createBase​(String name,
                                                     Class<T> type)
        Create 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
      • createBase

        public static <T> BaseProperty<T> createBase​(Expression expression,
                                                     Class<T> type)
        Create 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
      • createString

        public static <T extends CharSequenceStringProperty<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
      • createString

        public static <T extends CharSequenceStringProperty<T> createString​(String name,
                                                                              Class<T> type)
        Create 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
      • createString

        public static <T extends CharSequenceStringProperty<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
      • createNumeric

        public static <T extends NumberNumericProperty<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
      • createNumeric

        public static <T extends NumberNumericProperty<T> createNumeric​(String name,
                                                                          Class<T> type)
        Create 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
      • createNumeric

        public static <T extends NumberNumericProperty<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
      • createDate

        public static <T> DateProperty<T> createDate​(String name,
                                                     Expression expression,
                                                     Class<T> type)
        Create 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
      • createDate

        public static <T> DateProperty<T> createDate​(String name,
                                                     Class<T> type)
        Create 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
      • createDate

        public static <T> DateProperty<T> createDate​(Expression expression,
                                                     Class<T> type)
        Create 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
      • createEntity

        public static <T extends PersistentEntityProperty<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
      • createEntity

        public static <T extends PersistentEntityProperty<T> createEntity​(String name,
                                                                            Class<T> type)
        Create 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
      • createEntity

        public static <T extends PersistentEntityProperty<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
      • createSelf

        public static <T extends PersistentEntityProperty<T> createSelf​(Class<T> type)
        Self 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
      • createSelf

        public static <T extends PersistentEntityProperty<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 EntityProperty usage 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
      • createList

        public static <T extends PersistentListProperty<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
      • createList

        public static <T extends PersistentListProperty<T> createList​(String name,
                                                                        Class<T> entityType)
        Create 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
      • createSet

        public static <T extends PersistentSetProperty<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
      • createSet

        public static <T extends PersistentSetProperty<T> createSet​(String name,
                                                                      Class<T> entityType)
        Create 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
      • createMap

        public static <K,​V extends PersistentMapProperty<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
      • createMap

        public static <K,​V extends PersistentMapProperty<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
      • createEmbeddable

        public static <T extends EmbeddableObjectEmbeddableProperty<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
      • createEmbeddable

        public static <T extends EmbeddableObjectEmbeddableProperty<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