Class BeanInfo<T>

Type Parameters:
T - The raw class type this instance represents.
All Implemented Interfaces:
Comparable<ClassInfo>, Type, Annotatable
Direct Known Subclasses:
ClassMeta

public abstract class BeanInfo<T> extends ClassInfoTyped<T>
Bean-modeling SPI seam that exposes the type-classification surface the bean-runtime types (BeanMeta-equivalents, BeanPropertyMeta-equivalents, etc.) need without coupling the bean-modeling layer to the marshalling-side ClassMeta.

Marshalling-side ClassMeta&lt;T&gt; extends this class; bean-modeling-side code only sees BeanInfo. The bean-modeling-side never instantiates this class directly — it always gets instances handed in by the marshalling layer (e.g. via builder calls like BeanPropertyMeta.Builder#rawMetaType(ClassMeta)).

All extra abstract methods declared here mirror methods that ClassMeta already implements, so ClassMeta satisfies this contract by virtue of its existing implementation.

Thread safety
Thread safety depends on implementation.
  • Constructor Details

    • BeanInfo

      protected BeanInfo(Class<T> inner)
      Constructor.
      Parameters:
      inner - The class type.
    • BeanInfo

      protected BeanInfo(Class<T> inner, Type innerType)
      Constructor.
      Parameters:
      inner - The class type.
      innerType - The generic type (if parameterized type).
  • Method Details

    • isUri

      public abstract boolean isUri()
      Returns true if this class is a URI/URL or annotated with a URI marker.
      Returns:
      true if this class is a URI.
    • isBean

      public abstract boolean isBean()
      Returns true if this class is classified as a bean.
      Returns:
      true if this class is a bean.
    • getElementType

      public abstract BeanInfo<?> getElementType()
      For array and Collection types, returns the type info of the element type, or null if this is not an array/collection.
      Returns:
      The element type info, or null.
    • getKeyType

      public abstract BeanInfo<?> getKeyType()
      For Map types, returns the type info of the key type, or null if this is not a map.
      Returns:
      The key type info, or null.
    • getValueType

      public abstract BeanInfo<?> getValueType()
      For Map types, returns the type info of the value type, or null if this is not a map.
      Returns:
      The value type info, or null.
    • canCreateNewInstance

      public abstract boolean canCreateNewInstance()
      Returns true if this class can be instantiated using a no-arg constructor.
      Returns:
      true if a new instance can be created.
    • canCreateNewInstance

      public abstract boolean canCreateNewInstance(Object outer)
      Returns true if this class can be instantiated, optionally with the specified outer object for non-static inner classes.
      Parameters:
      outer - The outer object instance, or null if not applicable.
      Returns:
      true if a new instance can be created.
    • newInstance

      public abstract T newInstance() throws ExecutableException
      Creates a new instance of this class.
      Overrides:
      newInstance in class ClassInfo
      Returns:
      A new instance of the class.
      Throws:
      ExecutableException - If the class could not be instantiated.
    • getOptionalDefault

      public abstract Object getOptionalDefault()
      For Optional types, returns an empty optional default value, or null if this isn't an Optional.

      Returns Object rather than T because the marshalling-side ClassMeta returns a wildcard Optional<?> which is not assignable to T under Java's type system.

      Returns:
      The default empty Optional value, or null.
    • getBeanConfigContext

      Returns the BeanConfigContext associated with this type-info.

      On the marshalling-side this returns the bean-modeling subset of the MarshallingContext that carried this type-info; on commons-side BeanInfo construction paths (none exist in-tree currently; BeanInfo is currently always realized by marshalling-side ClassMeta), this should return the BeanConfigContext the type-info was built against.

      Returns:
      The bean-modeling configuration carried alongside this type-info. Never null.
    • getMarshallingContext

      public abstract Object getMarshallingContext()
      Returns the marshalling-side context associated with this type-info, as an opaque Object.

      On the marshalling-side this is the MarshallingContext that carried this type-info; the return type is widened to Object so callers in commons.bean do not need to import MarshallingContext. Callers cast to the marshalling-side type at the use site.

      Returns:
      The marshalling context, or null if none is associated with this type-info.