Package org.faktorips.runtime.model.type
Class ModelObjectAttributes
- java.lang.Object
-
- org.faktorips.runtime.model.type.ModelObjectAttributes
-
public class ModelObjectAttributes extends java.lang.ObjectCreates and modifiesModelObjectAttributes.- Since:
- 21.6
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.function.Predicate<ModelObjectAttribute>IS_IRRELEVANT_BUT_NOT_EMPTYThePredicateused inresetIrrelevantAttributes(IModelObject).
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<ModelObjectAttribute>of(IModelObject modelObject)Collects allModelObjectAttributesof the given model object.static java.util.List<ModelObjectAttribute>ofIncludingChildren(IModelObject modelObject)Collects allModelObjectAttributesof the given model object and its children.static java.util.List<ModelObjectAttribute>resetAttributes(IModelObject modelObject, java.util.function.Predicate<ModelObjectAttribute> shouldReset)Clears attributes of aIModelObjectand its dependent model-objects that match the givenPredicate.static java.util.List<ModelObjectAttribute>resetIrrelevantAttributes(IModelObject modelObject)Clearsirrelevantattributes of aIModelObjectand its dependent model-objects.
-
-
-
Field Detail
-
IS_IRRELEVANT_BUT_NOT_EMPTY
public static final java.util.function.Predicate<ModelObjectAttribute> IS_IRRELEVANT_BUT_NOT_EMPTY
ThePredicateused inresetIrrelevantAttributes(IModelObject). Can be combined viaand/orwith other predicates to refine the criteria passed toresetAttributes(IModelObject, Predicate).
-
-
Method Detail
-
of
public static java.util.List<ModelObjectAttribute> of(IModelObject modelObject)
Collects allModelObjectAttributesof the given model object.
-
ofIncludingChildren
public static java.util.List<ModelObjectAttribute> ofIncludingChildren(IModelObject modelObject)
Collects allModelObjectAttributesof the given model object and its children.
-
resetIrrelevantAttributes
public static java.util.List<ModelObjectAttribute> resetIrrelevantAttributes(IModelObject modelObject)
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 java.util.List<ModelObjectAttribute> resetAttributes(IModelObject modelObject, java.util.function.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:
IS_IRRELEVANT_BUT_NOT_EMPTY
-
-