Class BasicProperty<P>

  • Type Parameters:
    P - the type of the property content
    All Implemented Interfaces:
    Property<P>

    public final class BasicProperty<P>
    extends Object
    implements Property<P>
    A property that binds a Bean to a MetaProperty.

    This is the standard implementation of a property. It defers the strategy of getting and setting the value to the meta-property.

    This implementation is also a map entry to aid performance in maps.

    • Method Detail

      • of

        public static <P> BasicProperty<P> of​(Bean bean,
                                              MetaProperty<P> metaProperty)
        Factory to create a property avoiding duplicate generics.
        Type Parameters:
        P - the property type
        Parameters:
        bean - the bean that the property is bound to, not null
        metaProperty - the meta property, not null
        Returns:
        the property, not null
      • bean

        public <B extends Bean> B bean()
        Description copied from interface: Property
        Gets the bean which owns this property.

        Each property is fully owned by a single bean.

        Specified by:
        bean in interface Property<P>
        Type Parameters:
        B - the bean type
        Returns:
        the bean, not null
      • metaProperty

        public MetaProperty<P> metaProperty()
        Description copied from interface: Property
        Gets the meta-property representing the parts of the property that are common across all instances, such as the name.
        Specified by:
        metaProperty in interface Property<P>
        Returns:
        the meta-property, not null
      • equals

        public boolean equals​(Object obj)
        Description copied from interface: Property
        Checks if this property equals another.

        This compares the meta-property and value. It does not consider the property or bean types.

        Specified by:
        equals in interface Property<P>
        Overrides:
        equals in class Object
        Parameters:
        obj - the other property, null returns false
        Returns:
        true if equal
      • hashCode

        public int hashCode()
        Description copied from interface: Property
        Returns a suitable hash code.
        Specified by:
        hashCode in interface Property<P>
        Overrides:
        hashCode in class Object
        Returns:
        the hash code
      • toString

        public String toString()
        Returns a string that summarises the property.
        Overrides:
        toString in class Object
        Returns:
        a summary string, not null