Class EntityAttributeSpecificationProvider


  • public class EntityAttributeSpecificationProvider
    extends Object
    This is a class for providing Spring Data Jpa Specification for different entities attributes
    • Method Detail

      • provideSpecificationForEntityAttribute

        public static <T> org.springframework.data.jpa.domain.Specification<T> provideSpecificationForEntityAttribute​(String attribute,
                                                                                                                      String value)
        Provides specification for the attribute in some entity.
        Type Parameters:
        T - type of the entity, for which this specification will be created
        Parameters:
        attribute - name of the attribute in entity
        value - optional value of the attribute
        Returns:
        resulting specification, or null if the attribute's value was omitted
      • provideSpecificationForJoinedEntityAttribute

        public static <T> org.springframework.data.jpa.domain.Specification<T> provideSpecificationForJoinedEntityAttribute​(@NotNull
                                                                                                                            @NotNull javax.persistence.criteria.Join<T,​?> join,
                                                                                                                            @NotNull
                                                                                                                            @NotNull String attribute,
                                                                                                                            @Nullable
                                                                                                                            @Nullable String value)
        Provides specification for the attribute in a joined entity.
        Type Parameters:
        T - type of the entity, for which this specification will be created
        Parameters:
        join - join to an entity
        attribute - name of the attribute in joined entity
        value - optional value of the attribute
        Returns:
        resulting specification, or null if the attribute's value was omitted
      • provideSpecificationForJoinedEntityAttribute

        public static <T> org.springframework.data.jpa.domain.Specification<T> provideSpecificationForJoinedEntityAttribute​(@NotNull
                                                                                                                            @NotNull javax.persistence.criteria.Join<T,​?> join,
                                                                                                                            @NotNull
                                                                                                                            @NotNull String attribute,
                                                                                                                            @Nullable
                                                                                                                            @Nullable Object value)
        Provides specification for the attribute in a joined entity.
        Type Parameters:
        T - type of the entity, for which this specification will be created
        Parameters:
        join - join to an entity
        attribute - name of the attribute in joined entity
        value - optional value of the attribute as Object
        Returns:
        resulting specification, or null if the attribute's value was omitted