Package org.faktorips.runtime.model.type
Class ModelObjectAttributes
java.lang.Object
org.faktorips.runtime.model.type.ModelObjectAttributes
Creates and modifies
ModelObjectAttributes.- Since:
- 21.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Predicate<ModelObjectAttribute>ThePredicateused inresetIrrelevantAttributes(IModelObject). -
Method Summary
Modifier and TypeMethodDescriptionstatic List<ModelObjectAttribute>of(IModelObject modelObject) Collects allModelObjectAttributesof the given model object.static List<ModelObjectAttribute>ofIncludingChildren(IModelObject modelObject) Collects allModelObjectAttributesof the given model object and its children.static List<ModelObjectAttribute>resetAttributes(IModelObject modelObject, Predicate<ModelObjectAttribute> shouldReset) Clears attributes of aIModelObjectand its dependent model-objects that match the givenPredicate.static List<ModelObjectAttribute>resetIrrelevantAttributes(IModelObject modelObject) Clearsirrelevantattributes of aIModelObjectand its dependent model-objects.
-
Field Details
-
IS_IRRELEVANT_BUT_NOT_EMPTY
ThePredicateused inresetIrrelevantAttributes(IModelObject). Can be combined viaand/orwith other predicates to refine the criteria passed toresetAttributes(IModelObject, Predicate).
-
-
Method Details
-
of
Collects allModelObjectAttributesof the given model object. -
ofIncludingChildren
Collects allModelObjectAttributesof the given model object and its children. -
resetIrrelevantAttributes
Clearsirrelevantattributes of aIModelObjectand its dependent model-objects.If an attribute implements
NullObjectSupporttheNullObjectis used, String-attributes are set to an empty string. Otherwisenullis used to clear the attribute.For each cleared attribute a
ModelObjectAttributeis returned. It'sModelObjectAttribute.toObjectProperty()method may be used to generateMessagesabout the change.- Parameters:
modelObject- the object to clear- Returns:
- a list of
ModelObjectAttributesthat were cleared
-
resetAttributes
public static List<ModelObjectAttribute> resetAttributes(IModelObject modelObject, Predicate<ModelObjectAttribute> shouldReset) Clears attributes of aIModelObjectand its dependent model-objects that match the givenPredicate.If an attribute uses one of the
NullObjectSupport-datatypesDecimalandMoney, theNullObjectis used,String-attributes are set to an empty string. Otherwisenullis used to clear the attribute.For each cleared attribute a
ModelObjectAttributeis returned. It'sModelObjectAttribute.toObjectProperty()method may be used to generateMessagesabout the change.- Parameters:
modelObject- the object to clearshouldReset- a Predicate deciding which attributes to reset.- Returns:
- a list of
ModelObjectAttributesthat were cleared - See Also:
-