Klasse EntityPredicates

java.lang.Object
de.esoco.entity.EntityPredicates

public class EntityPredicates extends Object
This class defines several factory methods that create entity-specific predicates. These methods provide a way to create predicates in a better readable way, especially when concatenating predicates.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    static <E> de.esoco.lib.expression.Predicate<E>
    createWildcardFilter(String wildcard, org.obrel.core.RelationType<String>... filteredAttributes)
    Creates a wildcard filter predicate for certain text attributes of an entity type.
    static <E extends Entity>
    de.esoco.storage.QueryPredicate<E>
    forEntity(Class<E> entityClass, de.esoco.lib.expression.Predicate<? super E> criteria)
    A variant of StoragePredicates.forType(Class, Predicate) for entity queries.
    static <E extends Entity, V>
    de.esoco.lib.expression.Predicate<E>
    hasExtraAttribute(Class<E> entityType, de.esoco.lib.expression.Predicate<? super ExtraAttribute> criteria)
    Creates an entity predicate to query for entities that have an extra attribute that fulfill certain criteria.
    static <E extends Entity, V>
    de.esoco.lib.expression.predicate.ElementPredicate<E,V>
    ifAttribute(org.obrel.core.RelationType<V> type, de.esoco.lib.expression.Predicate<? super V> predicate)
    A Predicates.ifRelation(RelationType, Predicate) variant that provides better readability for entity attributes.
    static <E extends Entity, V>
    de.esoco.lib.expression.Predicate<E>
    ifExtraAttribute(org.obrel.core.RelationType<V> extraAttribute, V defaultValue, de.esoco.lib.expression.Predicate<? super V> predicate)
    Creates an ElementPredicate to evaluate a predicate on a certain extra attribute in entities.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Methodendetails

    • createWildcardFilter

      public static <E> de.esoco.lib.expression.Predicate<E> createWildcardFilter(String wildcard, org.obrel.core.RelationType<String>... filteredAttributes)
      Creates a wildcard filter predicate for certain text attributes of an entity type. The search string may contain wildcards as defined for StoragePredicates.createWildcardFilter(String). This method accepts NULL and empty arguments so that it can be invoked without the need to check the arguments. Such empty arguments will result in NULL being returned (which can then for example be fed into Predicates.and(Predicate, Predicate)).
      Parameter:
      wildcard - The wildcard filter string (can be NULL or empty)
      filteredAttributes - The text attributes to filter (can be NULL or empty)
      Gibt zurück:
      The resulting predicate (may be NULL if arguments are NULL or empty)
    • forEntity

      public static <E extends Entity> de.esoco.storage.QueryPredicate<E> forEntity(Class<E> entityClass, de.esoco.lib.expression.Predicate<? super E> criteria)
      A variant of StoragePredicates.forType(Class, Predicate) for entity queries.
      Siehe auch:
      • StoragePredicates.forType(Class, Predicate)
    • hasExtraAttribute

      public static <E extends Entity, V> de.esoco.lib.expression.Predicate<E> hasExtraAttribute(Class<E> entityType, de.esoco.lib.expression.Predicate<? super ExtraAttribute> criteria)
      Creates an entity predicate to query for entities that have an extra attribute that fulfill certain criteria.
      Parameter:
      entityType - The entity type to query for
      criteria - The extra attribute criteria
      Gibt zurück:
      A new predicate for the given extra attribute
    • ifAttribute

      public static <E extends Entity, V> de.esoco.lib.expression.predicate.ElementPredicate<E,V> ifAttribute(org.obrel.core.RelationType<V> type, de.esoco.lib.expression.Predicate<? super V> predicate)
      A Predicates.ifRelation(RelationType, Predicate) variant that provides better readability for entity attributes.
      Siehe auch:
      • Predicates.ifRelation(RelationType, Predicate)
    • ifExtraAttribute

      public static <E extends Entity, V> de.esoco.lib.expression.Predicate<E> ifExtraAttribute(org.obrel.core.RelationType<V> extraAttribute, V defaultValue, de.esoco.lib.expression.Predicate<? super V> predicate)
      Creates an ElementPredicate to evaluate a predicate on a certain extra attribute in entities. It creates an instance of the function GetElement.GetRelationValue to retrieve the relation target from objects.

      This predicate cannot be used for entity queries. It is only intended for the use in predicate evaluation on entities that have already been loaded. For queries the hasExtraAttribute(Class, Predicate) method should be used instead.

      Parameter:
      extraAttribute - The relation type of the extra attribute
      defaultValue - The default value if the attribute doesn't exist
      predicate - The predicate to evaluate the extra attribute with
      Gibt zurück:
      A new predicate for the given extra attribute