Class PropertyModel

  • All Implemented Interfaces:
    java.lang.Comparable<PropertyModel>

    public class PropertyModel
    extends java.lang.Object
    implements java.lang.Comparable<PropertyModel>
    A model for class property. Property is JavaBean alike meta information field / getter / setter of a property in class.
    • Constructor Detail

      • PropertyModel

        public PropertyModel​(PropertyModel a,
                             PropertyModel b)
        Create a new PropertyModel that merges two existing PropertyModel that have identical read/write names. The input PropertyModel objects MUST be equal (a.equals(b) == true)
        Parameters:
        a - a PropertyModel instance to merge
        b - the other PropertyModel instance to merge
      • PropertyModel

        public PropertyModel​(ClassModel classModel,
                             Property property,
                             JsonbContext jsonbContext)
        Creates an instance.
        Parameters:
        classModel - Class model of declaring class.
        property - Property.
        jsonbContext - Context.
    • Method Detail

      • getPropertyDeserializationType

        public java.lang.reflect.Type getPropertyDeserializationType()
        Returns which type should be used to deserialization.
        Returns:
        deserialization type
      • getPropertySerializationType

        public java.lang.reflect.Type getPropertySerializationType()
        Returns which type should be used to serialization.
        Returns:
        serialization type
      • getValue

        public java.lang.Object getValue​(java.lang.Object object)
        Gets property's value.
        Parameters:
        object - object to read property from
        Returns:
        property's value
      • setValue

        public void setValue​(java.lang.Object object,
                             java.lang.Object value)
        Sets a property. If not writable (final, transient, static), ignores property.
        Parameters:
        object - Object to set value in.
        value - Value to set.
      • isReadable

        public boolean isReadable()
        Property is readable. Based on access policy and java field modifiers.
        Returns:
        true if can be serialized to JSON
      • isWritable

        public boolean isWritable()
        Property is writable. Based on access policy and java field modifiers.
        Returns:
        true if can be deserialized from JSON
      • getPropertyName

        public java.lang.String getPropertyName()
        Default property name according to Field / Getter / Setter method names. This name is use for identifying properties, for JSON serialization is used customized name which may be derived from default name.
        Returns:
        default name
      • getClassModel

        public ClassModel getClassModel()
        Model of declaring class of this property.
        Returns:
        class model
      • getCustomization

        public PropertyCustomization getCustomization()
        Introspected customization of a property.
        Returns:
        immutable property customization
      • compareTo

        public int compareTo​(PropertyModel o)
        Specified by:
        compareTo in interface java.lang.Comparable<PropertyModel>
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getReadName

        public java.lang.String getReadName()
        Gets a name of JSON document property to read this property from.
        Returns:
        Name of JSON document property.
      • getWriteName

        public java.lang.String getWriteName()
      • getPropertySerializer

        public jakarta.json.bind.serializer.JsonbSerializer<?> getPropertySerializer()
        Gets serializer.
        Returns:
        Serializer.
      • getPropagation

        public PropertyValuePropagation getPropagation()
        Wrapper object of java.lang.reflect representations of this javabean property.
        Returns:
        Property model