Class PropertyContainer

    • Constructor Detail

      • PropertyContainer

        public PropertyContainer()
        Constructs a new, empty property container.
    • Method Detail

      • createObjectBacked

        public static PropertyContainer createObjectBacked​(Object object)
        Creates a property container for the given object. The factory method will not modify the object, thus not setting any default values.
        Parameters:
        object - the backing object
        Returns:
        The property container.
      • createObjectBacked

        public static PropertyContainer createObjectBacked​(Object object,
                                                           PropertyDescriptorFactory descriptorFactory)
        Creates a property container for the given object. The factory method will not modify the object, thus not setting any default values.
        Parameters:
        object - the backing object
        descriptorFactory - a factory used to create PropertyDescriptors of the fields of the object's type
        Returns:
        The property container.
      • createMapBacked

        public static PropertyContainer createMapBacked​(Map<String,​Object> map)
        Creates a property container for a map backing the values. The properties are derived from the current map entries.
        Parameters:
        map - the map which backs the values
        Returns:
        The property container.
      • createMapBacked

        public static PropertyContainer createMapBacked​(Map<String,​Object> map,
                                                        PropertySetDescriptor propertySetDescriptor)
        Creates a property container for a map backing the values. The factory method will not modify the given map, thus not setting any default values.
        Parameters:
        map - the map which backs the values
        propertySetDescriptor - A descriptor the property set to be created.
        Returns:
        The property container.
      • createMapBacked

        public static PropertyContainer createMapBacked​(Map<String,​Object> map,
                                                        Class<?> templateType)
        Creates a property container for the given template type and map backing the values. The factory method will not modify the given map, thus not setting any default values.
        Parameters:
        map - the map which backs the values
        templateType - the template type
        Returns:
        The property container.
      • createMapBacked

        public static PropertyContainer createMapBacked​(Map<String,​Object> map,
                                                        Class<?> templateType,
                                                        PropertyDescriptorFactory descriptorFactory)
        Creates a property container for the given template type and map backing the values. The factory method will not modify the given map, thus not setting any default values.
        Parameters:
        map - the map which backs the values
        templateType - the template type
        descriptorFactory - a factory used to create PropertyDescriptors of the fields of the template type
        Returns:
        The property container.
      • createValueBacked

        public static PropertyContainer createValueBacked​(Class<?> templateType)
        Creates a property container for the given template type. All properties will have their values set to default values (if specified).
        Parameters:
        templateType - the template type
        Returns:
        The property container.
      • createValueBacked

        public static PropertyContainer createValueBacked​(Class<?> templateType,
                                                          PropertyDescriptorFactory descriptorFactory)
        Creates a property container for the given template type. All properties will have their values set to default values (if specified).
        Parameters:
        templateType - the template class used to derive the descriptors from
        descriptorFactory - a factory used to create PropertyDescriptors of the fields of the template type
        Returns:
        The property container.
      • createForFields

        public static PropertyContainer createForFields​(Class<?> type,
                                                        PropertyDescriptorFactory descriptorFactory,
                                                        PropertyAccessorFactory accessorFactory,
                                                        boolean initValues)
        Creates a property container for the given template type. Properties are generated using the descriptorFactory and the accessorFactory which are called for each non-static and non-transient class field.
        Parameters:
        type - The type that provides the fields.
        descriptorFactory - The property descriptor factory.
        accessorFactory - The property accessor factory.
        initValues - If true, properties are initialised by their default values, if specified.
        Returns:
        The property container.
      • getProperties

        public Property[] getProperties()
        Description copied from interface: PropertySet
        Gets all properties currently contained in this set.
        Specified by:
        getProperties in interface PropertySet
        Returns:
        The array of properties, which may be empty.
      • isPropertyDefined

        public boolean isPropertyDefined​(String name)
        Description copied from interface: PropertySet
        Tests if the named property is defined in this set. For undefined properties, the method getProperty(name) will always return null.
        Specified by:
        isPropertyDefined in interface PropertySet
        Parameters:
        name - The property name or the property's alias name (both case sensitive).
        Returns:
        true if the property is defined.
      • addProperty

        public void addProperty​(Property property)
        Description copied from interface: PropertySet
        Adds a property to this set.
        Specified by:
        addProperty in interface PropertySet
        Parameters:
        property - The property.
      • addProperties

        public void addProperties​(Property... properties)
        Description copied from interface: PropertySet
        Adds the given properties to this set.
        Specified by:
        addProperties in interface PropertySet
        Parameters:
        properties - The properties to be added.
      • removeProperty

        public void removeProperty​(Property property)
        Description copied from interface: PropertySet
        Removes a property from this set.
        Specified by:
        removeProperty in interface PropertySet
        Parameters:
        property - The property.
      • removeProperties

        public void removeProperties​(Property... properties)
        Description copied from interface: PropertySet
        Removes the given properties from this set.
        Specified by:
        removeProperties in interface PropertySet
        Parameters:
        properties - The properties to be removed.
      • getValue

        public <T> T getValue​(String name)
        Description copied from interface: PropertySet
        Gets the value of the named property.
        Specified by:
        getValue in interface PropertySet
        Parameters:
        name - The property name.
        Returns:
        The property value or null if a property with the given name does not exist.
      • getDescriptor

        public PropertyDescriptor getDescriptor​(String name)
        Description copied from interface: PropertySet
        Gets the descriptor for the named property.
        Specified by:
        getDescriptor in interface PropertySet
        Parameters:
        name - The property name (case sensitive).
        Returns:
        The descriptor, or null if the property is unknown.