Class PropertyCondition

All Implemented Interfaces:
Condition, Serializable

public class PropertyCondition extends SkippableCondition<PropertyCondition>
Condition for filtering by entity property.

Use one of the static methods like equal(String, Object), greater(String, Object) to create property conditions.

See Also:
  • Constructor Details

    • PropertyCondition

      public PropertyCondition()
  • Method Details

    • createWithParameterName

      public static PropertyCondition createWithParameterName(String property, String operation, String parameterName)
      Creates property condition with the specified parameter name. The parameter value must be provided by calling setParameterValue(Object) method.
      Parameters:
      property - entity attribute name
      operation - comparison operation, see PropertyCondition.Operation constants
      parameterName - parameter name
    • createWithValue

      public static PropertyCondition createWithValue(String property, String operation, Object parameterValue)
      Creates a condition to compare the property with the provided value. A parameter name is generated based on the property name.
      Parameters:
      property - entity attribute name
      operation - comparison operation, see PropertyCondition.Operation constants.
      parameterValue - value to compare with
    • create

      public static PropertyCondition create(String property, String operation, Object value)
      Creates a condition to compare the property with the given value.
      Parameters:
      property - entity attribute name
      operation - comparison operation, see constants in PropertyCondition.Operation
      value - value to compare with
    • equal

      public static PropertyCondition equal(String property, Object value)
      Creates "=" condition.
    • notEqual

      public static PropertyCondition notEqual(String property, Object value)
      Creates "!=" condition.
    • greater

      public static PropertyCondition greater(String property, Object value)
      Creates ">" condition.
    • greaterOrEqual

      public static PropertyCondition greaterOrEqual(String property, Object value)
      Creates ">=" condition.
    • less

      public static PropertyCondition less(String property, Object value)
      Creates "<" condition.
    • lessOrEqual

      public static PropertyCondition lessOrEqual(String property, Object value)
      Creates "<=" condition.
    • contains

      public static PropertyCondition contains(String property, Object value)
      Creates a condition that is translated to "like %value%".
    • startsWith

      public static PropertyCondition startsWith(String property, Object value)
      Creates a condition that is translated to "like value%".
    • endsWith

      public static PropertyCondition endsWith(String property, Object value)
      Creates a condition that is translated to "like %value".
    • isSet

      public static PropertyCondition isSet(String property, Object value)
      Creates a condition that is translated to "is null" or "is not null" depending on the parameter value.
    • inList

      public static PropertyCondition inList(String property, Object value)
      Creates a condition that is translated to "in".
    • notInList

      public static PropertyCondition notInList(String property, Object value)
      Creates a condition that is translated to "not in".
    • isCollectionEmpty

      public static PropertyCondition isCollectionEmpty(String property, Object value)
      Creates a condition that is translated to "is empty" or "is not empty" depending on the parameter value.
    • memberOfCollection

      public static PropertyCondition memberOfCollection(String property, Object value)
      Creates a condition that is translated to "member of".
    • notMemberOfCollection

      public static PropertyCondition notMemberOfCollection(String property, Object value)
      Creates a condition that is translated to "not member of".
    • getProperty

      public String getProperty()
    • setProperty

      public void setProperty(String property)
    • getOperation

      public String getOperation()
    • setOperation

      public void setOperation(String operation)
    • getParameterName

      public String getParameterName()
    • setParameterName

      public void setParameterName(String parameterName)
    • getParameterValue

      @Nullable public Object getParameterValue()
    • setParameterValue

      public void setParameterValue(@Nullable Object parameterValue)
    • getParameters

      public Collection<String> getParameters()
      Description copied from interface: Condition
      Returns parameters specified in the condition.
    • actualize

      @Nullable public Condition actualize(Set<String> actualParameters, boolean defaultSkipNullOrEmpty)
      Description copied from interface: Condition
      Checks whether the argument contains all parameters specified in the condition.
      defaultSkipNullOrEmpty - default value for SkippableCondition.skipNullOrEmpty, should be obtained using CoreProperties.isSkipNullOrEmptyConditionsByDefault()
      Returns:
      the condition if SkippableCondition.skipNullOrEmpty is false or if actualParameters contains all parameters specified in the condition and these parameters are not null or empty. Otherwise returns null.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • copy

      public PropertyCondition copy()
      Description copied from interface: Condition
      Returns a deep copy of this condition.
    • getExcludedParameters

      public Set<String> getExcludedParameters(Set<String> actualParameters)