Class PropertyCondition

java.lang.Object
io.jmix.core.querycondition.PropertyCondition
All Implemented Interfaces:
Condition, Serializable

public class PropertyCondition extends Object implements Condition
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".
    • 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.
      Specified by:
      getParameters in interface Condition
    • actualize

      @Nullable public Condition actualize(Set<String> actualParameters)
      Description copied from interface: Condition
      Returns the condition if the argument contains all parameters specified in the condition.
      Specified by:
      actualize in interface Condition
    • 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.
      Specified by:
      copy in interface Condition
    • getExcludedParameters

      public Set<String> getExcludedParameters(Set<String> actualParameters)
      Specified by:
      getExcludedParameters in interface Condition