Class BasicProperty<P>

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

    public final class BasicProperty<P>
    extends java.lang.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 Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <B extends Bean>
      B
      bean()
      Gets the bean which owns this property.
      boolean equals​(java.lang.Object obj)
      Checks if this property equals another.
      int hashCode()
      Returns a suitable hash code.
      MetaProperty<P> metaProperty()
      Gets the meta-property representing the parts of the property that are common across all instances, such as the name.
      static <P> BasicProperty<P> of​(Bean bean, MetaProperty<P> metaProperty)
      Factory to create a property avoiding duplicate generics.
      java.lang.String toString()
      Returns a string that summarises the property.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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​(java.lang.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 java.lang.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 java.lang.Object
        Returns:
        the hash code
      • toString

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