See Android Developers Blog article
Note
this module is a no-op when no Android-desugared records are being (de)serialized, so it is safe to use in code shared between Android and non-Android platforms.
Note
the canonical record constructor is identified through matching of parameter names and types with fields. Therefore, this module doesn't allow a deserialized desugared record to have a custom constructor with the same set of parameter names and types as the canonical one. For the same reason, this module requires that desugared canonical record constructor parameter names be stored in class files. Apparently, with Android SDK 34 tooling, that is the case by default. If that ever changes, it may require an explicit setting in build files.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static Class | |
| pack-priv static Type | |
| pack-priv static Stream | |
| pack-priv static boolean | |
| public void | setupModule(JacksonModule.
Overrides tools. Standard implementation handles registration of all configured customizations: it is important that sub-classes call this implementation (usually before additional custom logic) if they choose to override it; otherwise customizations will not be registered. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides tools. | |
| AndroidRecordModule | back to summary |
|---|---|
| public AndroidRecordModule() | |
| arrayTypeCompat | back to summary |
|---|---|
| pack-priv static Class | |
| fixAndroidGenericType | back to summary |
|---|---|
| pack-priv static Type fixAndroidGenericType(Type type) | |
| getDesugaredRecordComponents | back to summary |
|---|---|
| pack-priv static Stream | |
| isDesugaredRecordClass | back to summary |
|---|---|
| pack-priv static boolean isDesugaredRecordClass(Class<?> raw) | |
| setupModule | back to summary |
|---|---|
| public void setupModule(JacksonModule. Overrides tools. Doc from tools. Standard implementation handles registration of all configured customizations: it is important that sub-classes call this implementation (usually before additional custom logic) if they choose to override it; otherwise customizations will not be registered.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public PotentialCreator | findPreferredCreator(MapperConfig<?> config, AnnotatedClass valueClass, List<PotentialCreator> declaredConstructors, List<PotentialCreator> declaredFactories, Optional<PotentialCreator> zeroParamsConstructor)
Overrides tools. Method called to check if introspector can find a Creator it considers
its "Preferred Creator": Creator to use as the primary one, when no Creator has
explicit annotation ( |
| public Version | version()
Implements abstract tools. Implements tools. Method called to detect version of the component that implements this interface;
returned version should never be null, but may return specific "not available"
instance (see |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| AndroidRecordAnnotationIntrospector | back to summary |
|---|---|
| pack-priv AndroidRecordAnnotationIntrospector() | |
| findPreferredCreator | back to summary |
|---|---|
| public PotentialCreator findPreferredCreator(MapperConfig<?> config, AnnotatedClass valueClass, List<PotentialCreator> declaredConstructors, List<PotentialCreator> declaredFactories, Optional<PotentialCreator> zeroParamsConstructor) Overrides tools. Doc from tools. Method called to check if introspector can find a Creator it considers
its "Preferred Creator": Creator to use as the primary one, when no Creator has
explicit annotation ( Note when returning chosen Creator, it may be necessary to mark its "mode"
with Note method is NOT called for Java Record types; selection of the canonical constructor
as the Primary creator is handled directly by Note was called
| |
| version | back to summary |
|---|---|
| public Version version() Implements abstract tools. Implements tools. Doc from tools. Method called to detect version of the component that implements this interface;
returned version should never be null, but may return specific "not available"
instance (see
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected POJOPropertiesCollector | collectProperties(JavaType type, AnnotatedClass classDef, boolean forSerialization, String mutatorPrefix)
Overrides tools.
|
| public BasicClassIntrospector | forMapper()
Overrides tools. Method called to create an instance to be exclusive used by specified mapper. |
| public BasicClassIntrospector | forOperation(MapperConfig<?> config)
Overrides tools. Method called to further create an instance to be used for a single operation
(read or write, typically matching |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides tools. | |
| AndroidRecordClassIntrospector | back to summary |
|---|---|
| public AndroidRecordClassIntrospector() | |
| AndroidRecordClassIntrospector | back to summary |
|---|---|
| pack-priv AndroidRecordClassIntrospector(MapperConfig<?> config) | |
| collectProperties | back to summary |
|---|---|
| protected POJOPropertiesCollector collectProperties(JavaType type, AnnotatedClass classDef, boolean forSerialization, String mutatorPrefix) Overrides tools.
| |
| forMapper | back to summary |
|---|---|
| public BasicClassIntrospector forMapper() Overrides tools. Doc from tools. Method called to create an instance to be exclusive used by specified mapper. Needed to ensure that no sharing through cache occurs. Basic implementation just returns instance itself.
| |
| forOperation | back to summary |
|---|---|
| public BasicClassIntrospector forOperation(MapperConfig<?> config) Overrides tools. Doc from tools. Method called to further create an instance to be used for a single operation
(read or write, typically matching
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Set | _componentNames
Names of actual Record components from definition; auto-detected. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public String | findNameForRegularGetter(AnnotatedMethod am, String name)
Overrides tools. Method called to find whether given method would be considered a "regular" getter method in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property) Note that signature acceptability has already been checked (no arguments, does have a return value) by caller. |
| _componentNames | back to summary |
|---|---|
| private final Set<String> _componentNames Names of actual Record components from definition; auto-detected. | |
| AndroidRecordNaming | back to summary |
|---|---|
| pack-priv AndroidRecordNaming(MapperConfig<?> config, AnnotatedClass forClass) | |
| findNameForRegularGetter | back to summary |
|---|---|
| public String findNameForRegularGetter(AnnotatedMethod am, String name) Overrides tools. Doc from tools. Method called to find whether given method would be considered a "regular" getter method in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property) Note that signature acceptability has already been checked (no arguments, does have a return value) by caller.
Note that this method MAY be called for potential "is-getter" methods too
(before Note that visibility checks are applied separately; strategy does not need to be concerned with that aspect.
| |