Class ComplexAttributeImpl

    • Method Detail

      • getValue

        public Collection<? extends Property> getValue()
        Description copied from interface: Property
        The value or content of the property.

        The class of this object is defined by getType().getBinding().

        This value may be null. In this case getDescriptor().isNillable() would be true.

        Specified by:
        getValue in interface ComplexAttribute
        Specified by:
        getValue in interface Property
        Overrides:
        getValue in class PropertyImpl
        Returns:
        The value of the property.
      • getProperties

        public Collection<Property> getProperties()
        Description copied from interface: ComplexAttribute
        Complete collection of properties.

        This method is a convenience method for calling (Collection) getValue().

        Specified by:
        getProperties in interface ComplexAttribute
        Returns:
        The complete collection of properties.
      • properties

        protected List<Property> properties()
        Internal helper method for getting at the properties without wrapping in unmodifiable collection.
      • getProperties

        public Collection<Property> getProperties​(Name name)
        Description copied from interface: ComplexAttribute
        Returns a subset of the properties of the complex attribute which match the specified name.

        The name parameter is matched against each contained Property.getName(), those that are equal are returned.

        Specified by:
        getProperties in interface ComplexAttribute
        Parameters:
        name - The name of the properties to return.
        Returns:
        The collection of properties which match the specified name, or an empty collection if no such properties match.
      • findLast

        public Optional<Property> findLast​(Name name)
        Returns:
        the first property in getProperties() reverse order whose name equals the given name
      • findAll

        public Stream<Property> findAll​(Predicate<? super Property> predicate)
        Returns:
        all properties that match the provided predicate, may be empty, never null
      • find

        public Optional<Property> find​(Predicate<? super Property> predicate)
        Returns:
        the first property that matches the provided predicate, or Optional.empty()
      • getProperty

        public Property getProperty​(Name name)
        Description copied from interface: ComplexAttribute
        Returns single property of the complex attribute which matches the specified name.

        Note: This method is a convenience and care should be taken when calling it if more then a single property matches name. In such a case the first encountered property in which Property.getName() is equal to name is returned, and no order is guaranteed.

        This method is a safe convenience for: getProperties(name).iterator().next().

        In the event that no property matches the specified name null is returned.

        Specified by:
        getProperty in interface ComplexAttribute
        Parameters:
        name - The name of the property to return.
        Returns:
        The property matching the specified name, or null.
      • getProperty

        public Property getProperty​(String name)
        Description copied from interface: ComplexAttribute
        Returns single property of the complex attribute which matches the specified name.

        This method is a convenience for ComplexAttribute.getProperty(Name) in which Name.getNamespaceURI() is null.

        Note: This method is a convenience and care should be taken when calling it if more then a single property matches name. In such a case the first encountered property in which Property.getName() is matches name is returned, and no order is guaranteed.

        Note: Special care should be taken when using this method in the case that two properties with the same local name but different namespace uri exist. For this reason using ComplexAttribute.getProperties(Name) is safer.

        Specified by:
        getProperty in interface ComplexAttribute
        Parameters:
        name - The local name of the property to return.
        Returns:
        The property matching the specified name, or null.
      • setValue

        public void setValue​(Object newValue)
                      throws IllegalArgumentException,
                             IllegalStateException
        Description copied from class: AttributeImpl
        Override of setValue to convert the newValue to specified type if need be.
        Specified by:
        setValue in interface Property
        Overrides:
        setValue in class AttributeImpl
        Parameters:
        newValue - The new value of the property.
        Throws:
        IllegalArgumentException
        IllegalStateException
      • setValue

        public void setValue​(Collection<Property> newValue)
        Description copied from interface: ComplexAttribute
        Sets the contained properties of the complex attribute.

        The values should match the structure defined by getDescriptor().

        Specified by:
        setValue in interface ComplexAttribute
      • addValue

        public void addValue​(Property value)
        Appends a property to this attribute's property list without incurring in unnecessary object allocation such as safe-copying the values list as in setValue(Collection)