Package org.apache.juneau.marshall
Class BeanRegistry
java.lang.Object
org.apache.juneau.marshall.BeanRegistry
- All Implemented Interfaces:
BeanRegistryLookup
A lookup table for resolving bean types by name.
In a nutshell, provides a simple mapping of bean class objects to identifying names.
Class names are defined through the @Marshalled(typeName) annotation.
The dictionary is used by the framework in the following ways:
- If a class type cannot be inferred through reflection during parsing, then a helper
"_type" is added to the serialized output using the name defined for that class in this dictionary. This helps determine the real class at parse time. - The dictionary name is used as element names when serialized to XML.
-
Method Summary
Modifier and TypeMethodDescriptionClassMeta<?>getClassMeta(String typeName) Gets the class metadata for the specified bean type name.getTypeName(Class<?> c) Given the specified raw class, return the dictionary name for it.getTypeName(ClassMeta<?> c) Given the specified class, return the dictionary name for it.booleanReturnstrue if this dictionary has an entry for the specified type name.toString()
-
Method Details
-
getClassMeta
Gets the class metadata for the specified bean type name.- Parameters:
typeName- The bean type name as defined by@Marshalled(typeName). Can include multi-dimensional array type names (e.g."X^^" ).
Can benull (returnsnull ).- Returns:
- The class metadata for the bean, or
null if the registry is empty, the type name isnull , or no matching entry was found.
-
getTypeName
Given the specified class, return the dictionary name for it.- Parameters:
c- The class to lookup in this registry. Can benull (returnsnull ).- Returns:
- The dictionary name for the specified class in this registry, or
null if not found.
-
getTypeName
Given the specified raw class, return the dictionary name for it.Variant of
getTypeName(ClassMeta)that takes the rawClassdirectly so callers in the bean-modeling layer (which is being decoupled fromClassMeta) can perform a polymorphic-dispatch lookup without holding aClassMetareference.- Specified by:
getTypeNamein interfaceBeanRegistryLookup- Parameters:
c- The class to lookup in this registry. Can benull (returnsnull ).- Returns:
- The dictionary name for the specified class in this registry, or
null if not found.
-
hasName
Returnstrue if this dictionary has an entry for the specified type name.- Specified by:
hasNamein interfaceBeanRegistryLookup- Parameters:
typeName- The bean type name. Can benull (returnsfalse ).- Returns:
true if this dictionary has an entry for the specified type name.
-
properties
-
toString
-