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 | |
| private 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(Module.
Overrides com. 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 com. | |
| 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(Module. Overrides com. Doc from com. 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 | findDefaultCreator(MapperConfig<?>
Configuration settings in effect (for deserialization) config, AnnotatedClass Class being instantiated; defines Creators passed valueClass, List<PotentialCreator> Constructors value class declares declaredConstructors, List<PotentialCreator> Factory methods value class declares declaredFactories)Overrides com. Method called to check if introspector can find a Creator it considers
the "Primary Creator": Creator to use as the primary one, when no Creator has
explicit annotation ( |
| public Version | version()
Implements abstract com. Implements com. 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() | |
| findDefaultCreator | back to summary |
|---|---|
| public PotentialCreator findDefaultCreator(MapperConfig<?> config, AnnotatedClass valueClass, List<PotentialCreator> declaredConstructors, List<PotentialCreator> declaredFactories) Overrides com. Doc from com. Method called to check if introspector can find a Creator it considers
the "Primary 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 naming of this method is unfortunately inconsistent in that "default Creator"
has other meanings than "primary Creator" -- in other places Jackson code
refers to no-arguments Constructors as "default Creators". So this method
ought to have been named
| |
| version | back to summary |
|---|---|
| public Version version() Implements abstract com. Implements com. Doc from com. 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 |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected POJOPropertiesCollector | collectProperties(MapperConfig<?> config, JavaType type, ClassIntrospector.
Overrides com.
|
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides com. | |
| AndroidRecordClassIntrospector | back to summary |
|---|---|
| pack-priv AndroidRecordClassIntrospector() | |
| collectProperties | back to summary |
|---|---|
| protected POJOPropertiesCollector collectProperties(MapperConfig<?> config, JavaType type, ClassIntrospector. Overrides com.
| |
| 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
Method to check am, String Name to check (usually same as name)AnnotatedMethod#getName()Overrides com. 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 com. Doc from com. 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.
| |