Class EntityFieldMap
java.lang.Object
org.apache.ofbiz.entity.condition.EntityFieldMap
- All Implemented Interfaces:
Serializable
,IsEmpty
,EntityCondition
A condition expression corresponding to an unordered collection of
conditions containing two values compared with a comparison operator
and that are joined by an operator.
The main objective it to express the conjunction or disjunction of a set of
conditions which in the case of conjunction corresponds to SQL expression
of the form foo=bar AND bar=baz AND ...
and where the comparison
operator is =
and the join operator is AND
.
- See Also:
-
Field Summary
Fields inherited from interface org.apache.ofbiz.entity.condition.EntityCondition
serialVersionUID
-
Constructor Summary
ConstructorDescriptionEntityFieldMap
(Map<String, V> fieldMap, EntityComparisonOperator<?, ?> compOp, EntityJoinOperator joinOp) Constructs a map of fields.EntityFieldMap
(EntityComparisonOperator<?, ?> compOp, EntityJoinOperator joinOp, V... keysValues) Constructs a map of fields. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(EntityConditionVisitor visitor) Applies a visitor to this condition.void
checkCondition
(ModelEntity modelEntity) Verifies that this condition expression is valid.boolean
containsField
(String name) Checks if the field map contains the fieldname
.boolean
freeze()
Create a Frozen condition expression corresponding to this condition expression.getCondition
(int index) Gets the condition expression stored at a particular of the internal list of conditions.List<? extends EntityExpr>
Gets the value associated with fieldname
.Provides an iterator on the entries contained in the field map.Provides an iterator on the fields contained in the field map.Gets the infix operator used to combine every elements in the list of conditions.int
hashCode()
boolean
isEmpty()
makeWhereString
(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, Datasource datasourceInfo) Dumps the corresponding SQL string.boolean
mapMatches
(Delegator delegator, Map<String, ? extends Object> map) Checks that this condition expression matches a particular entity.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.ofbiz.entity.condition.EntityCondition
entityMatches, makeWhereString
-
Constructor Details
-
EntityFieldMap
@SafeVarargs public EntityFieldMap(EntityComparisonOperator<?, ?> compOp, EntityJoinOperator joinOp, V... keysValues) Constructs a map of fields.- Type Parameters:
V
- The type of values that are compared.- Parameters:
compOp
- the operator used to compare fieldsjoinOp
- the operator used to join field comparisonskeysValues
- a list of values that the field map will contain. This list must be of even length and each successive pair will be associated in the field map.
-
EntityFieldMap
public EntityFieldMap(Map<String, V> fieldMap, EntityComparisonOperator<?, ?> compOp, EntityJoinOperator joinOp) Constructs a map of fields.- Type Parameters:
V
- the type of values contained infieldMap
- Parameters:
fieldMap
- the map containing the fields to comparecompOp
- the operator to compare fieldsjoinOp
- the operator to join entries in the field map
-
-
Method Details
-
getField
Gets the value associated with fieldname
.- Parameters:
name
- the name of the field- Returns:
- the value associated with field
name
- Throws:
NullPointerException
- if the specified name isnull
and the field map does not permit null keys
-
containsField
Checks if the field map contains the fieldname
.- Parameters:
name
- the name of the field to search- Returns:
true
if field is defined in the field map- Throws:
NullPointerException
- if the specified name isnull
and the field map does not permit null keys
-
getFieldKeyIterator
Provides an iterator on the fields contained in the field map.- Returns:
- an iterator of fields
-
getFieldEntryIterator
Provides an iterator on the entries contained in the field map.- Returns:
- an iterator of field entries
-
accept
Description copied from interface:EntityCondition
Applies a visitor to this condition.- Parameters:
visitor
- the visitor to be applied
-
getConditions
-
getOperator
Gets the infix operator used to combine every elements in the list of conditions.- Returns:
- the infix operator used to combine every elements in the list of conditions.
-
getCondition
Gets the condition expression stored at a particular of the internal list of conditions.- Parameters:
index
- the index of the condition expression to find- Returns:
- the corresponding condition expression
-
isEmpty
public boolean isEmpty() -
makeWhereString
public String makeWhereString(ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, Datasource datasourceInfo) Description copied from interface:EntityCondition
Dumps the corresponding SQL string.- Specified by:
makeWhereString
in interfaceEntityCondition
- Parameters:
modelEntity
- the model of the entityentityConditionParams
- the effective parameters used to substitute '?' parametersdatasourceInfo
- the model of the data source interpreting the SQL- Returns:
- the corresponding SQL string
-
checkCondition
Description copied from interface:EntityCondition
Verifies that this condition expression is valid.- Specified by:
checkCondition
in interfaceEntityCondition
- Parameters:
modelEntity
- the model of the entity- Throws:
GenericModelException
- when this condition expression is not valid
-
mapMatches
Description copied from interface:EntityCondition
Checks that this condition expression matches a particular entity.- Specified by:
mapMatches
in interfaceEntityCondition
- Parameters:
delegator
- the delegator used to matchmap
- the entity definition to match- Returns:
true
if this condition expression matchesmap
when usingdelegator
-
freeze
Description copied from interface:EntityCondition
Create a Frozen condition expression corresponding to this condition expression.- Specified by:
freeze
in interfaceEntityCondition
- Returns:
- the frozen condition expression
-
equals
-
hashCode
public int hashCode() -
toString
-