Class PropertyModel
java.lang.Object
org.eclipse.yasson.internal.model.PropertyModel
- All Implemented Interfaces:
Comparable<PropertyModel>
A model for class property.
Property is JavaBean alike meta information field / getter / setter of a property in class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClassModelModel of the class this field belongs to.private final PropertyCustomizationCustomization of this property.private final Fieldprivate final Methodprivate final Typeprivate final MethodHandleprivate static final MethodHandles.Lookupprivate final Propertyprivate final StringField propertyName as in class by java bean convention.private final TypeField propertyType.private final StringCalculated name to be used when reading json document.private final Methodprivate final Typeprivate final MethodHandleprivate final StringCalculated name to be used when writing json document. -
Constructor Summary
ConstructorsConstructorDescriptionPropertyModel(ClassModel classModel, Property property, JsonbContext jsonbContext) Creates an instance.Create a new PropertyModel that merges two existing PropertyModel that have identical read/write names. -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringcalculateReadWriteName(String readWriteName, String propertyName, jakarta.json.bind.config.PropertyNamingStrategy strategy) If customized by JsonbPropertyAnnotation, than is used, otherwise use strategy to translate.intprivate static MethodHandlecreateReadHandle(Field field, Method getter, boolean getterVisible, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) private static MethodHandlecreateWriteHandle(Field field, Method setter, boolean setterVisible, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) booleanModel of declaring class of this property.Introspected customization of a property.getField()Field of a javabean property.Setter of a javabean property.Returns which type should be used to deserialization.Default property name according to Field / Getter / Setter method names.Returns which type should be used to serialization.Gets a name of JSON document property to read this property from.Getter of a javabean property.private static <T> TgetTargetForMostPreciseScope(Map<AnnotationTarget, T> collectedAnnotations, AnnotationTarget... targets) Pull result for most significant scope defined by order of annotation targets.private SerializerBinding<?> getUserSerializerBinding(Property property, JsonbContext jsonbContext) Gets property's value.inthashCode()private PropertyCustomizationintrospectCustomization(Property property, JsonbContext jsonbContext, ClassModel classModel) private static voidintrospectDateFormatter(Property property, AnnotationIntrospector introspector, PropertyCustomization.Builder builder, JsonbContext jsonbContext) private static voidintrospectNumberFormatter(Property property, AnnotationIntrospector introspector, PropertyCustomization.Builder builder) private static booleanisFieldVisible(Field field, Method method, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) private static booleanisMethodVisible(Method method, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) private static booleanisNotPublicAndNonNested(Class<?> declaringClass) static booleanisPropertyReadable(Field field, Method getter, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) booleanProperty is readable.private static booleanisVisible(Predicate<jakarta.json.bind.config.PropertyVisibilityStrategy> visibilityCheckFunction, Method method, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) Look up class and package level @JsonbVisibility, or global config PropertyVisibilityStrategy.booleanProperty is writable.private static voidoverrideAccessible(AccessibleObject accessibleObject) voidSets a property.
-
Field Details
-
LOOKUP
-
propertyName
Field propertyName as in class by java bean convention. -
readName
Calculated name to be used when reading json document. -
writeName
Calculated name to be used when writing json document. -
propertyType
Field propertyType. -
classModel
Model of the class this field belongs to. -
property
-
customization
Customization of this property. -
getValueHandle
-
setValueHandle
-
field
-
getter
-
setter
-
getterMethodType
-
setterMethodType
-
-
Constructor Details
-
PropertyModel
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
Creates an instance.- Parameters:
classModel- Class model of declaring class.property- Property.jsonbContext- Context.
-
-
Method Details
-
getPropertyDeserializationType
Returns which type should be used to deserialization.- Returns:
- deserialization type
-
getPropertySerializationType
Returns which type should be used to serialization.- Returns:
- serialization type
-
getUserSerializerBinding
-
introspectCustomization
private PropertyCustomization introspectCustomization(Property property, JsonbContext jsonbContext, ClassModel classModel) -
introspectDateFormatter
private static void introspectDateFormatter(Property property, AnnotationIntrospector introspector, PropertyCustomization.Builder builder, JsonbContext jsonbContext) -
introspectNumberFormatter
private static void introspectNumberFormatter(Property property, AnnotationIntrospector introspector, PropertyCustomization.Builder builder) -
getTargetForMostPreciseScope
private static <T> T getTargetForMostPreciseScope(Map<AnnotationTarget, T> collectedAnnotations, AnnotationTarget... targets) Pull result for most significant scope defined by order of annotation targets.- Parameters:
collectedAnnotations- all targetstargets- ordered target types by scope
-
getValue
-
setValue
-
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
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
-
getCustomization
Introspected customization of a property.- Returns:
- immutable property customization
-
compareTo
- Specified by:
compareToin interfaceComparable<PropertyModel>
-
equals
-
hashCode
-
getReadName
Gets a name of JSON document property to read this property from.- Returns:
- Name of JSON document property.
-
getWriteName
-
calculateReadWriteName
private static String calculateReadWriteName(String readWriteName, String propertyName, jakarta.json.bind.config.PropertyNamingStrategy strategy) If customized by JsonbPropertyAnnotation, than is used, otherwise use strategy to translate. Since this is cached for performance reasons strategy has to be consistent with calculated values for same input. -
getField
-
getGetter
-
getSetter
-
isPropertyReadable
-
createReadHandle
private static MethodHandle createReadHandle(Field field, Method getter, boolean getterVisible, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) -
createWriteHandle
private static MethodHandle createWriteHandle(Field field, Method setter, boolean setterVisible, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) -
isFieldVisible
-
isNotPublicAndNonNested
-
isMethodVisible
private static boolean isMethodVisible(Method method, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) -
overrideAccessible
-
isVisible
private static boolean isVisible(Predicate<jakarta.json.bind.config.PropertyVisibilityStrategy> visibilityCheckFunction, Method method, jakarta.json.bind.config.PropertyVisibilityStrategy strategy) Look up class and package level @JsonbVisibility, or global config PropertyVisibilityStrategy. If any is found it is used for resolving visibility by calling provided visibilityCheckFunction.- Parameters:
visibilityCheckFunction- function declaring visibility check- Returns:
- Optional with result of visibility check, or empty optional if no strategy is found
-
getGetValueHandle
-
getSetValueHandle
-