Interface IPropertyHolder
- All Superinterfaces:
IPropertyHolderConst
- All Known Implementing Classes:
PropertyContainer, Structure
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanRemoveProperty(Property<?> property) Checks if a property can be removed from this property holder.<T> IPropertyValue<T> removeProperty(Property<T> property) Removes the given property from this property container.<T> IPropertyValue<T> setPropertyValue(Property<T> property, @Nullable T value) Sets the value of the given property.Methods inherited from interface IPropertyHolderConst
getPropertyValue, getRequiredPropertyValue, hasProperties, hasProperties, hasProperties, hasProperty, propertyCount
-
Method Details
-
setPropertyValue
Sets the value of the given property.- Type Parameters:
T- The type of the property.- Parameters:
property- The property to set the value for.value- The value to set.If this is
null, the property will be removed.- Returns:
- The previous value of the property, or
nullif the property had no value set. - Throws:
IllegalArgumentException- If the value is null and the property cannot be removed (i.e. it is specified byStructureType.getProperties()).
-
canRemoveProperty
Checks if a property can be removed from this property holder.A property can not be removed under the following conditions:
-
The property is required (e.g. defined by
StructureType.getProperties()). - The property does not exist in this property holder.
- Parameters:
property- The property to check.- Returns:
trueif the property can be removed from this property holder,falseotherwise.
-
The property is required (e.g. defined by
-
removeProperty
Removes the given property from this property container.Properties cannot be removed under certain conditions. When in doubt, check
canRemoveProperty(Property).- Type Parameters:
T- The type of the property.- Parameters:
property- The property to remove.- Returns:
- The previous value of the property, or
PropertyContainer.UnsetPropertyValue.INSTANCEif the property was not set. - Throws:
IllegalArgumentException- Thrown if;-
the property cannot be removed (i.e. it is specified by
StructureType.getProperties()). - the type of the removed property does not match the type of the property specified by the property.
-
the property cannot be removed (i.e. it is specified by
-