Class BeanRegistry

java.lang.Object
org.apache.juneau.BeanRegistry

public class BeanRegistry extends Object
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 @Bean(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.
See Also:
  • Method Details

    • getClassMeta

      public ClassMeta<?> getClassMeta(String typeName)
      Gets the class metadata for the specified bean type name.
      Parameters:
      typeName - The bean type name as defined by @Bean(typeName). Can include multi-dimensional array type names (e.g. "X^^").
      Returns:
      The class metadata for the bean.
    • getTypeName

      public String getTypeName(ClassMeta<?> c)
      Given the specified class, return the dictionary name for it.
      Parameters:
      c - The class to lookup in this registry.
      Returns:
      The dictionary name for the specified class in this registry, or null if not found.
    • hasName

      public boolean hasName(String typeName)
      Returns true if this dictionary has an entry for the specified type name.
      Parameters:
      typeName - The bean type name.
      Returns:
      true if this dictionary has an entry for the specified type name.
    • toString

      public String toString()
      Overrides:
      toString in class Object