Class PropertyModel
- java.lang.Object
-
- org.eclipse.yasson.internal.model.PropertyModel
-
- All Implemented Interfaces:
Comparable<PropertyModel>
public 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.- Author:
- Dmitry Kornilov, Roman Grigoriadi
-
-
Constructor Summary
Constructors Constructor Description PropertyModel(ClassModel classModel, Property property, JsonbContext jsonbContext)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PropertyModel o)
boolean
equals(Object o)
ClassModel
getClassModel()
Model of declaring class of this property.PropertyCustomization
getCustomization()
Introspected customization of a property.PropertyValuePropagation
getPropagation()
Wrapper object ofjava.lang.reflect
representations of this javabean property.Type
getPropertyDeserializationType()
Returns which type should be used to deserializationString
getPropertyName()
Default property name according to Field / Getter / Setter method names.Type
getPropertySerializationType()
Returns which type should be used to serializationjavax.json.bind.serializer.JsonbSerializer<?>
getPropertySerializer()
Gets serializer.String
getReadName()
Gets a name of JSON document property to read this property from.Object
getValue(Object object)
Gets property's value.String
getWriteName()
int
hashCode()
boolean
isReadable()
Property is readable.boolean
isWritable()
Property is writable.void
setValue(Object object, Object value)
Sets a property.
-
-
-
Constructor Detail
-
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:
compareTo
in 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 javax.json.bind.serializer.JsonbSerializer<?> getPropertySerializer()
Gets serializer.- Returns:
- Serializer.
-
getPropagation
public PropertyValuePropagation getPropagation()
Wrapper object ofjava.lang.reflect
representations of this javabean property.- Returns:
- Property model
-
-