Interface IPropertyHolder

All Superinterfaces:
IPropertyHolderConst
All Known Implementing Classes:
PropertyContainer, Structure

public interface IPropertyHolder extends IPropertyHolderConst
  • Method Details

    • setPropertyValue

      <T> IPropertyValue<T> setPropertyValue(Property<T> property, @Nullable T value)
      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 null if the property had no value set.
      Throws:
      IllegalArgumentException - If the value is null and the property cannot be removed (i.e. it is specified by StructureType.getProperties()).
    • canRemoveProperty

      boolean canRemoveProperty(Property<?> property)
      Checks if a property can be removed from this property holder.

      A property can not be removed under the following conditions:

      Parameters:
      property - The property to check.
      Returns:
      true if the property can be removed from this property holder, false otherwise.
    • removeProperty

      <T> IPropertyValue<T> removeProperty(Property<T> property) throws IllegalArgumentException
      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.INSTANCE if 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.