Class CompositePropertySet

  • All Implemented Interfaces:
    Countable, Extendable<PropertySet>, Mergable<PropertySet>, MutablePropertyValueSource, PropertySet, PropertyValueSource, java.io.Serializable, java.lang.Iterable<PropertyValue>

    public class CompositePropertySet
    extends java.lang.Object
    implements PropertySet
    A composite property set holds multiple other property sets, and loops through them to find properties.

    In regards to the property set interface, any adds or merges will be applied to a new internal propertyset. In other words, the operations will work as expected in regards to this object, but nothing will be transfered to the other property sets. However, removal operations will be applied to each wrapped propertyset.

    See Also:
    Serialized Form
    • Constructor Detail

      • CompositePropertySet

        public CompositePropertySet​(java.util.List<PropertySet> sets)
      • CompositePropertySet

        public CompositePropertySet​(PropertySet... sets)
    • Method Detail

      • iterator

        public java.util.Iterator<PropertyValue> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<PropertyValue>
      • getOrElse

        public <T> T getOrElse​(Property<T> property,
                               T value)
        Description copied from interface: PropertyValueSource
        Get the value for a given Property, or else fall back to value if it's not present.
        Specified by:
        getOrElse in interface PropertyValueSource
        Parameters:
        property - The Property for which a value is to be retrieved.
        value - The value to default to if property isn't present.
        Returns:
        The value of property if present, value if not. Can return null if the value is null.
      • getValues

        public java.util.List<PropertyValue> getValues()
        Description copied from interface: PropertyValueSource
        Returns the opaque PropertyValue objects. This can be useful when you want to avoid the strict type checking of the value, and it's important to note that if the property is bound, the value will be a BoundValue. Be very careful about overriding, and make sure to maintain the methodology of using getProperties to iterate and get (or getOrDefault), to get the value, because those are all handled differently by BoundPropertySets, ExtendedPropertySets, etc.
        Specified by:
        getValues in interface PropertyValueSource
      • isExtended

        public boolean isExtended​(Property<?> prop)
        Description copied from interface: PropertySet
        Returns whether this property set contains a value for the prop, and the prop was actually inherited. In other words, this is true if the property is inherited, and an override value is present.
        Specified by:
        isExtended in interface PropertySet
      • isInherited

        public boolean isInherited​(Property<?> prop)
        Description copied from interface: PropertySet
        Indicates whether the property was inherited from a parent type.
        Specified by:
        isInherited in interface PropertySet