- java.lang.Object
-
- org.eclipse.yasson.internal.model.PropertyModel
-
- All Implemented Interfaces:
Comparable<PropertyModel>
public final class PropertyModel extends Object implements Comparable<PropertyModel>
A model for class property. Property is JavaBean alike meta information field / getter / setter of a property in class.
-
-
Constructor Summary
Constructors Constructor Description PropertyModel(ClassModel classModel, Property property, JsonbContext jsonbContext)Creates an instance.PropertyModel(PropertyModel a, PropertyModel b)Create a new PropertyModel that merges two existing PropertyModel that have identical read/write names.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(PropertyModel o)booleanequals(Object o)ClassModelgetClassModel()Model of declaring class of this property.PropertyCustomizationgetCustomization()Introspected customization of a property.FieldgetField()Field of a javabean property.MethodgetGetter()Setter of a javabean property.TypegetPropertyDeserializationType()Returns which type should be used to deserialization.StringgetPropertyName()Default property name according to Field / Getter / Setter method names.TypegetPropertySerializationType()Returns which type should be used to serialization.jakarta.json.bind.serializer.JsonbSerializer<?>getPropertySerializer()Gets serializer.StringgetReadName()Gets a name of JSON document property to read this property from.MethodgetSetter()Getter of a javabean property.ObjectgetValue(Object object)Gets property's value.StringgetWriteName()inthashCode()static booleanisPropertyReadable(Field field, Method getter, jakarta.json.bind.config.PropertyVisibilityStrategy strategy)booleanisReadable()Property is readable.booleanisWritable()Property is writable.voidsetValue(Object object, Object value)Sets a property.
-
-
-
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 mergeb- 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 Type getPropertyDeserializationType()
Returns which type should be used to deserialization.- Returns:
- deserialization type
-
getPropertySerializationType
public Type getPropertySerializationType()
Returns which type should be used to serialization.- Returns:
- serialization type
-
getValue
public Object getValue(Object object)
Gets property's value.- Parameters:
object- object to read property from- Returns:
- property's value
-
setValue
public void setValue(Object object, 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 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:
compareToin interfaceComparable<PropertyModel>
-
getReadName
public String getReadName()
Gets a name of JSON document property to read this property from.- Returns:
- Name of JSON document property.
-
getWriteName
public String getWriteName()
-
getPropertySerializer
public jakarta.json.bind.serializer.JsonbSerializer<?> getPropertySerializer()
Gets serializer.- Returns:
- Serializer.
-
-