Class ClassMeta<T>

Type Parameters:
T - The class type of the wrapped class.
All Implemented Interfaces:
Comparable<ClassInfo>, Type, Annotatable

@BeanType(properties="innerClass,elementType,keyType,valueType,notABeanReason,initException,beanMeta") public final class ClassMeta<T> extends BeanInfo<T>
A wrapper class around the Class object that provides cached information about that class.

Instances of this class can be created through the MarshallingContext.getClassMeta(Class) method.

The MarshallingContext class will cache and reuse instances of this class except for the following class types:

  • Arrays
  • Maps with non-Object key/values.
  • Collections with non-Object key/values.

This class is tied to the MarshallingContext class because it's that class that makes the determination of what is a bean.

  • Method Details

    • findSwap

      protected ObjectSwap<?,?> findSwap(Class<?> c)
    • findUnswap

      protected ObjectSwap<?,?> findUnswap(Class<?> c)
    • canCreateNewBean

      public boolean canCreateNewBean(Object outer)
      Returns true if this class can be instantiated as a bean. Returns false if this is a non-static member class and the outer object does not match the class type of the defining class.
      Parameters:
      outer - The outer class object for non-static member classes. Can be null for non-member or static classes.
      Returns:
      true if a new instance of this bean can be created within the context of the specified outer object.
    • canCreateNewInstance

      public boolean canCreateNewInstance()
      Returns true if this class has a no-arg constructor or invocation handler.
      Specified by:
      canCreateNewInstance in class BeanInfo<T>
      Returns:
      true if a new instance of this class can be constructed.
    • canCreateNewInstance

      public boolean canCreateNewInstance(Object outer)
      Returns true if this class has a no-arg constructor or invocation handler. Returns false if this is a non-static member class and the outer object does not match the class type of the defining class.
      Specified by:
      canCreateNewInstance in class BeanInfo<T>
      Parameters:
      outer - The outer class object for non-static member classes. Can be null for non-member or static classes.
      Returns:
      true if a new instance of this class can be created within the context of the specified outer object.
    • canCreateNewInstanceFromString

      public boolean canCreateNewInstanceFromString(Object outer)
      Returns true if this class can call the newInstanceFromString(Object, String) method.
      Parameters:
      outer - The outer class object for non-static member classes. Can be null for non-member or static classes.
      Returns:
      true if this class has a no-arg constructor or invocation handler.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class ClassInfo
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ClassInfo
    • forEachAnnotation

      public <A extends Annotation> ClassMeta<T> forEachAnnotation(Class<A> type, Predicate<A> filter, Consumer<A> action)
      Performs an action on all matching annotations of the specified type defined on this class or parent classes/interfaces in parent-to-child order.
      Type Parameters:
      A - The annotation type to look for.
      Parameters:
      type - The annotation to search for.
      filter - A predicate to apply to the entries to determine if action should be performed. Can be null (if null, all entries are accepted).
      action - An action to perform on the entry.
      Returns:
      This object.
    • getArg

      public ClassMeta<?> getArg(int index)
      Returns the argument metadata at the specified index if this is an args metadata object.
      Parameters:
      index - The argument index.
      Returns:
      The argument metadata. Never null.
      Throws:
      BeanRuntimeException - If this metadata object is not a list of arguments, or the index is out of range.
    • getArgs

      public List<ClassMeta<?>> getArgs()
      Returns the argument types of this meta.
      Returns:
      The argument types of this meta, or null if this isn't an array of argument types.
    • getMarshallingContext

      Returns the MarshallingContext that created this object.

      Covariantly overrides BeanInfo.getMarshallingContext() to narrow the return type from Object (commons SPI) back to MarshallingContext (marshalling-side concrete type).

      Specified by:
      getMarshallingContext in class BeanInfo<T>
      Returns:
      The bean context, or null if this is an arguments-array metadata object (see isArgs()).
    • getBeanConfigContext

      Returns the BeanConfigContext snapshot carried by the MarshallingContext that built this ClassMeta.

      Satisfies the BeanInfo.getBeanConfigContext() commons SPI contract.

      Specified by:
      getBeanConfigContext in class BeanInfo<T>
      Returns:
      The bean-modeling configuration of the marshalling context. Never null.
    • getBeanMeta

      public BeanMeta<T> getBeanMeta()
      Returns the BeanMeta associated with this class.
      Returns:
      The BeanMeta associated with this class, or null if there is no bean meta associated with this class.
    • getBeanMeta

      public BeanMeta<T> getBeanMeta(PropertyNamer propertyNamer)
      Same as getBeanMeta() but derives property names using the supplied PropertyNamer instead of the one configured on the owning context.

      Unlike getBeanMeta(), the returned BeanMeta is built fresh on each call and is not cached — the shared, Class-keyed default BeanMeta (which uses the context's default namer) is left untouched. This keeps the cache safe when callers request an alternate property-naming strategy (e.g. MarshallingSession#toBeanMap(Object, PropertyNamer)).

      Parameters:
      propertyNamer - The property namer to use for deriving property names. Must not be null.
      Returns:
      A newly-built BeanMeta whose property names reflect the supplied namer, or null if there is no bean meta associated with this class.
    • getBeanRegistry

      Returns the bean registry for this class.

      This bean registry contains names specified in the @Marshalled(dictionary) annotation defined on the class, regardless of whether the class is an actual bean. This allows interfaces to define subclasses with type names.

      This is a shortcut for calling getBeanMeta().getBeanRegistry().

      Returns:
      The bean registry for this class, or null if no bean registry is associated with it.
    • getBuilderSwap

      Returns the builder swap associated with this class.
      Parameters:
      session - The current bean session (retained for API compatibility).
      Returns:
      The builder swap associated with this class, or null if it doesn't exist.
    • getBeanDictionaryName

      Returns the bean dictionary name associated with this class.

      The lexical name is defined by @Marshalled(typeName).

      Returns:
      The type name associated with this bean class, or null if there is no type name defined or this isn't a bean.
    • getElementType

      For array and Collection types, returns the class type of the components of the array or Collection.
      Specified by:
      getElementType in class BeanInfo<T>
      Returns:
      The element class type, or null if this class is not an array or Collection.
    • getExample

      public T getExample(MarshallingSession session, JsonParserSession jpSession)
      Returns the example of this class.
      Parameters:
      session - The bean session.
      Required because the example method may take it in as a parameter.
      jpSession - The JSON parser for parsing examples into POJOs.
      Returns:
      An example instance of this class, or null if no example is defined or one could not be created.
    • canConvertFrom

      public boolean canConvertFrom(Class<?> c)
      Returns true if this class can be instantiated from the specified input type.
      Parameters:
      c - The input class type.
      Returns:
      true if a conversion exists.
    • getImplClassConstructor

      Returns the no-arg constructor for this class based on the Marshalled.implClass() value.
      Parameters:
      conVis - The constructor visibility.
      Returns:
      The no-arg constructor for this class, or null if it does not exist.
    • getKeyType

      public ClassMeta<?> getKeyType()
      For Map types, returns the class type of the keys of the Map.
      Specified by:
      getKeyType in class BeanInfo<T>
      Returns:
      The key class type, or null if this class is not a Map.
    • getNameProperty

      Returns the method or field annotated with @NameProperty.
      Returns:
      The method or field annotated with @NameProperty or null if method does not exist.
    • getNotABeanReason

      Returns the reason why this class is not a bean, or null if it is a bean.
      Returns:
      The reason why this class is not a bean, or null if it is a bean.
    • getOptionalDefault

      If this is an Optional, returns an empty optional.

      Note that if this is a nested optional, will recursively create empty optionals.

      Specified by:
      getOptionalDefault in class BeanInfo<T>
      Returns:
      An empty optional, or null if this isn't an optional.
    • isPrimitiveOptional

      public boolean isPrimitiveOptional()
      Returns true if this is one of the primitive Optional cousins (OptionalInt, OptionalLong, or OptionalDouble).

      These types carry no generic element type but are treated as first-class optional types by the marshallers (mirroring the Optional contract — empty ≡ null/absent, present unwraps to the primitive number). See getElementType() which synthesizes the matching boxed element type.

      Returns:
      true if this is OptionalInt/OptionalLong/OptionalDouble.
    • isOptional

      public boolean isOptional()
      Returns true if this class is Optional or one of its primitive cousins (OptionalInt/OptionalLong/OptionalDouble).

      Overrides ClassInfo.isOptional() so the marshalling layer treats the three primitive optional types as first-class optionals (synthetic boxed element type, empty-as-null contract) without registering swaps for them.

      Overrides:
      isOptional in class ClassInfo
      Returns:
      true if this is an optional-like type.
    • getParentProperty

      Returns the method or field annotated with @ParentProperty.
      Returns:
      The method or field annotated with @ParentProperty or null if method does not exist.
    • getProperty

      public <T2> Optional<T2> getProperty(String name, Function<ClassMeta<?>,T2> function)
      Returns a lazily-computed, cached property value for this ClassMeta instance.

      This method provides a memoization mechanism for expensive computations. The property value is computed on the first call using the provided function, then cached for subsequent calls with the same property name.

      The function is only invoked once per property name per ClassMeta instance. Subsequent calls with the same name will return the cached value without re-invoking the function.

      Thread Safety:

      This method is thread-safe. If multiple threads call this method simultaneously with the same property name, the function may be invoked multiple times, but only one result will be cached and returned.

      Usage:

      // Compute and cache an expensive property Optional<String> computedValue = classMeta.getProperty("expensiveProperty", cm -> { // Expensive computation that only runs once return performExpensiveComputation(cm); }); // Subsequent calls return cached value Optional<String> cached = classMeta.getProperty("expensiveProperty", cm -> { // This function is NOT called again return performExpensiveComputation(cm); });

      Type Parameters:
      T2 - The type of the property value.
      Parameters:
      name - The unique name identifying this property. Used as the cache key.
      function - The function that computes the property value. Receives this ClassMeta instance as input. Only invoked if the property hasn't been computed yet. Can return null.
      Returns:
      An Optional containing the property value if the function returned a non-null value, otherwise an empty Optional. Never null.
    • getProxyInvocationHandler

      Returns the interface proxy invocation handler for this class.
      Returns:
      The interface proxy invocation handler, or null if it does not exist.
    • getSerializedClassMeta

      Returns the serialized (swapped) form of this class if there is an ObjectSwap associated with it.
      Parameters:
      session - The bean session.
      Required because the swap used may depend on the media type being serialized or parsed.
      Returns:
      The serialized class type, or this object if no swap is associated with the class.
    • getSwap

      public ObjectSwap<T,?> getSwap(MarshallingSession session)
      Returns the ObjectSwap associated with this class that's the best match for the specified session.
      Parameters:
      session - The current bean session.
      If multiple swaps are associated with a class, only the first one with a matching media type will be returned.
      Returns:
      The ObjectSwap associated with this class, or null if there are no POJO swaps associated with this class.
    • canConvertTo

      public boolean canConvertTo(Class<?> c)
      Returns true if this class can be converted to the specified output type.
      Parameters:
      c - The output class type.
      Returns:
      true if a conversion exists.
    • getValueType

      public ClassMeta<?> getValueType()
      For Map types, returns the class type of the values of the Map.
      Specified by:
      getValueType in class BeanInfo<T>
      Returns:
      The value class type, or null if this class is not a Map.
    • getParameters

      public Type[] getParameters()
      Returns the type parameters for this class as a Type array suitable for passing to Converter.to(Object, Type, Type...).

      The returned array depends on the kind of type:

      • Map types: [keyType, valueType]
      • Collection and Optional types: [elementType, elementType.getParameters()...] — the element raw class followed by the element's own parameters, recursively flattened by one level.
      • All other types: empty array.
      Examples:
      • ClassMeta<Optional<Integer>> → [Integer]
      • ClassMeta<List<Integer>> → [Integer]
      • ClassMeta<Map<String,Integer>> → [String, Integer]
      • ClassMeta<List<Map<String,Integer>>> → [Map, String, Integer]
      Returns:
      The type parameters as a Type array, never null.
    • hasInputStreamMutater

      public boolean hasInputStreamMutater()
      Returns true if this class has a transform associated with it that allows it to be created from an InputStream.

      Only returns true for types that can be explicitly constructed from an InputStream (e.g. via a public constructor or static factory). Excludes assignable supertypes and the generic toString() fallback.

      Returns:
      true if this class has a transform associated with it that allows it to be created from an InputStream.
    • hasMutaterFrom

      public boolean hasMutaterFrom(Class<?> c)
      Returns true if this class can be instantiated from the specified type via an explicit conversion.

      Same-type conversions (identity) always return true. Strict supertype relationships (where this class is already a supertype of the source) return false — those are assignability, not explicit transforms.

      Parameters:
      c - The class type to convert from. Must not be null.
      Returns:
      true if an explicit conversion from c to this type exists.
    • hasMutaterFrom

      public boolean hasMutaterFrom(ClassMeta<?> c)
      Returns true if this class can be instantiated from the specified type via an explicit conversion.
      Parameters:
      c - The class type to convert from. Must not be null.
      Returns:
      true if an explicit conversion from c to this type exists.
    • hasMutaterTo

      public boolean hasMutaterTo(Class<?> c)
      Returns true if this class can be transformed to the specified type via an explicit conversion.

      Same-type conversions (identity) always return true. Cases where the target is already a strict supertype of this class return false — those are assignability, not explicit transforms.

      Parameters:
      c - The class type to convert to. Must not be null.
      Returns:
      true if an explicit conversion from this type to c exists.
    • hasMutaterTo

      public boolean hasMutaterTo(ClassMeta<?> c)
      Returns true if this class can be transformed to the specified type via an explicit conversion.
      Parameters:
      c - The class type to convert to. Must not be null.
      Returns:
      true if an explicit conversion from this type to c exists.
    • hasReaderMutater

      public boolean hasReaderMutater()
      Returns true if this class has a transform associated with it that allows it to be created from a Reader.

      Only returns true for types that can be explicitly constructed from a Reader (e.g. via a public constructor or static factory). Excludes assignable supertypes and the generic toString() fallback.

      Returns:
      true if this class has a transform associated with it that allows it to be created from a Reader.
    • hasStringMutater

      public boolean hasStringMutater()
      Returns true if this class has a transform associated with it that allows it to be created from a String.

      Delegates to hasMutaterFrom(Class) with String as the source type, which applies the same exclusions: supertypes of String (e.g. Object), arrays, and Collection/Map targets are excluded because those are handled by parsers or MarshallingSession, not explicit string transforms.

      Returns:
      true if this class has a transform associated with it that allows it to be created from a String.
    • isArgs

      public boolean isArgs()
      Returns true if this metadata represents an array of argument types.
      Returns:
      true if this metadata represents an array of argument types.
    • isBean

      public boolean isBean()
      Returns true if this class is a bean.
      Specified by:
      isBean in class BeanInfo<T>
      Returns:
      true if this class is a bean.
    • isBeanMap

      public boolean isBeanMap()
      Returns true if this class is a subclass of BeanMap.
      Returns:
      true if this class is a subclass of BeanMap.
    • isBoolean

      public boolean isBoolean()
      Returns true if this class is a Boolean.
      Overrides:
      isBoolean in class ClassInfo
      Returns:
      true if this class is a Boolean.
    • isByteArray

      public boolean isByteArray()
      Returns true if this class is byte[].
      Returns:
      true if this class is byte[].
    • isCalendar

      public boolean isCalendar()
      Returns true if this class is a Calendar.
      Returns:
      true if this class is a Calendar.
    • isChar

      public boolean isChar()
      Returns true if this class is a Character.
      Returns:
      true if this class is a Character.
    • isCharSequence

      public boolean isCharSequence()
      Returns true if this class is a subclass of CharSequence.
      Overrides:
      isCharSequence in class ClassInfo
      Returns:
      true if this class is a subclass of CharSequence.
    • isCollection

      public boolean isCollection()
      Returns true if this class is a subclass of Collection.
      Overrides:
      isCollection in class ClassInfo
      Returns:
      true if this class is a subclass of Collection.
    • isCollectionOrArrayOrOptional

      Returns true if this class is a subclass of Collection or is an array or Optional.
      Returns:
      true if this class is a subclass of Collection or is an array or Optional.
    • isDate

      public boolean isDate()
      Returns true if this class is a Date.
      Returns:
      true if this class is a Date.
    • isDateOrCalendar

      public boolean isDateOrCalendar()
      Returns true if this class is a Date or Calendar.
      Overrides:
      isDateOrCalendar in class ClassInfo
      Returns:
      true if this class is a Date or Calendar.
    • isDateOrCalendarOrTemporal

      public boolean isDateOrCalendarOrTemporal()
      Returns true if this class is a Date or Calendar or Temporal.
      Returns:
      true if this class is a Date or Calendar or Temporal.
    • isDecimal

      public boolean isDecimal()
      Returns true if this class is a subclass of Float or Double.
      Overrides:
      isDecimal in class ClassInfo
      Returns:
      true if this class is a subclass of Float or Double.
    • isDelegate

      public boolean isDelegate()
      Returns true if this class implements Delegate, meaning it's a representation of some other object.
      Returns:
      true if this class implements Delegate.
    • isDouble

      public boolean isDouble()
      Returns true if this class is either Double or double.
      Overrides:
      isDouble in class ClassInfo
      Returns:
      true if this class is either Double or double.
    • isFloat

      public boolean isFloat()
      Returns true if this class is either Float or float.
      Returns:
      true if this class is either Float or float.
    • isInputStream

      public boolean isInputStream()
      Returns true if this class is an InputStream.
      Returns:
      true if this class is an InputStream.
    • isInteger

      public boolean isInteger()
      Returns true if this class is either Integer or int.
      Returns:
      true if this class is either Integer or int.
    • isIterable

      public boolean isIterable()
      Returns true if this class implements Iterable but is not a Collection.
      Returns:
      true if this class implements Iterable but is not a Collection.
      Since:
      9.2.1
    • isIterator

      public boolean isIterator()
      Returns true if this class implements Iterator or Enumeration.
      Returns:
      true if this class implements Iterator or Enumeration.
      Since:
      9.2.1
    • isStreamable

      public boolean isStreamable()
      Returns true if this class is an Iterator, Iterable (non-Collection), or BaseStream.

      These types represent lazily-evaluated sequences that can be serialized as arrays.

      Returns:
      true if this class is a streamable type.
      Since:
      9.2.1
    • isList

      public boolean isList()
      Returns true if this class extends from List.
      Returns:
      true if this class extends from List.
    • isLong

      public boolean isLong()
      Returns true if this class is either Long or long.
      Overrides:
      isLong in class ClassInfo
      Returns:
      true if this class is either Long or long.
    • isMap

      public boolean isMap()
      Returns true if this class is a subclass of Map.
      Overrides:
      isMap in class ClassInfo
      Returns:
      true if this class is a subclass of Map.
    • isMapOrBean

      public boolean isMapOrBean()
      Returns true if this class is a subclass of Map or it's a bean.
      Returns:
      true if this class is a subclass of Map or it's a bean.
    • isMethod

      public boolean isMethod()
      Returns true if this class is Method.
      Returns:
      true if this class is Method.
    • isNullable

      public boolean isNullable()
      Returns true if instance of this object can be null.

      Objects can be null, but primitives cannot, except for chars which can be represented by (char)0.

      Returns:
      true if instance of this class can be null.
    • isNumber

      public boolean isNumber()
      Returns true if this class is a subclass of Number.
      Overrides:
      isNumber in class ClassInfo
      Returns:
      true if this class is a subclass of Number.
    • isReader

      public boolean isReader()
      Returns true if this class is a Reader.
      Returns:
      true if this class is a Reader.
    • isSet

      public boolean isSet()
      Returns true if this class extends from Set.
      Returns:
      true if this class extends from Set.
    • isShort

      public boolean isShort()
      Returns true if this class is either Short or short.
      Returns:
      true if this class is either Short or short.
    • isStream

      public boolean isStream()
      Returns true if this class is a subclass of BaseStream (includes Stream).
      Returns:
      true if this class is a subclass of BaseStream.
      Since:
      9.2.1
    • isString

      public boolean isString()
      Returns true if this class is a String.
      Returns:
      true if this class is a String.
    • isTemporal

      public boolean isTemporal()
      Returns true if this class is a Temporal.
      Overrides:
      isTemporal in class ClassInfo
      Returns:
      true if this class is a Temporal.
    • isDuration

      public boolean isDuration()
      Returns true if this class is a Duration.
      Returns:
      true if this class is a Duration.
    • isPeriod

      public boolean isPeriod()
      Returns true if this class is a Period.
      Returns:
      true if this class is a Period.
    • isUri

      public boolean isUri()
      Returns true if this class is a URI or URL.
      Specified by:
      isUri in class BeanInfo<T>
      Returns:
      true if this class is a URI or URL.
    • mutateFrom

      public T mutateFrom(Object o)
      Converts the specified object into an instance of this class.
      Parameters:
      o - The object to convert.
      Returns:
      The converted object, or null if no conversion is available.
    • mutateTo

      public static <O> O mutateTo(Object o, Class<O> c)
      Converts the specified object to the specified output type.
      Type Parameters:
      O - The output class.
      Parameters:
      o - The object to convert.
      c - The target class.
      Returns:
      The converted object, or null if no conversion is available.
    • mutateTo

      public static <O> O mutateTo(Object o, ClassMeta<O> c)
      Converts the specified object to the type represented by this class meta.
      Type Parameters:
      O - The output class.
      Parameters:
      o - The object to convert.
      c - The target class meta. Must not be null.
      Returns:
      The converted object, or null if no conversion is available.
    • newInstance

      Create a new instance of the main class of this declared type.
      Specified by:
      newInstance in class BeanInfo<T>
      Returns:
      A new instance of the object, or null if there is no no-arg constructor on the object.
      Throws:
      ExecutableException - Exception occurred on invoked constructor/method/field.
    • newInstance

      public T newInstance(Object outer) throws ExecutableException
      Same as newInstance() except for instantiating non-static member classes.
      Parameters:
      outer - The instance of the owning object of the member class instance. Can be null if instantiating a non-member or static class.
      Returns:
      A new instance of the object, or null if there is no no-arg constructor on the object.
      Throws:
      ExecutableException - Exception occurred on invoked constructor/method/field.
    • newInstanceFromString

      Create a new instance of the main class of this declared type from a String input.

      In order to use this method, the class must have one of the following methods:

      • public static T valueOf(String in);
      • public static T fromString(String in);
      • public T(String in);
      Parameters:
      outer - The outer class object for non-static member classes. Can be null for non-member or static classes.
      arg - The input argument value.
      Returns:
      A new instance of the object, or null if there is no string constructor on the object.
      Throws:
      ExecutableException - Exception occurred on invoked constructor/method/field.
    • same

      public boolean same(ClassMeta<?> cm)
      Similar to equals(Object) except primitive and Object types that are similar are considered the same. (e.g. boolean == Boolean).
      Parameters:
      cm - The class meta to compare to. Can be null, in which case this method returns false.
      Returns:
      true if the specified class-meta is equivalent to this one.
    • toString

      public String toString()
      Description copied from class: ClassInfo
      Returns a detailed string representation of this class.

      The returned string includes:

      • Modifiers (public, private, protected, static, final, abstract, etc.)
      • Class type (class, interface, enum, annotation, or record)
      • Fully qualified class name
      • Generic type parameters with bounds (if any)
      Examples:

      // Regular class ClassInfo.of(String.class).toString(); // Returns: "public final class java.lang.String" // Interface ClassInfo.of(List.class).toString(); // Returns: "public interface java.util.List" // Generic class ClassInfo.of(ArrayList.class).toString(); // Returns: "public class java.util.ArrayList<E>" // Generic class with bounds ClassInfo ci = ClassInfo.of(Comparable.class); ci.toString(); // Returns: "public interface java.lang.Comparable<T>" // Enum ClassInfo.of(Month.class).toString(); // Returns: "public enum java.time.Month" // Record ClassInfo record = ClassInfo.of(MyRecord.class); record.toString(); // Returns: "public record org.example.MyRecord"

      Notes:
      • For interfaces, the "abstract" modifier is omitted since it's implicit.
      • For non-class types (e.g., TypeVariable, ParameterizedType), returns the result of Type.toString().
      • Type parameters include bounds when present (e.g., "<T extends Comparable<T>>").
      Comparison with Other Methods:
      Overrides:
      toString in class ClassInfo
      Returns:
      A detailed string representation including modifiers, class type, name, and type parameters.
    • toString

      public String toString(boolean simple)
      Same as toString() except use simple class names.
      Parameters:
      simple - Print simple class names only (no package).
      Returns:
      A new string.
    • toString

      public String toString(Object t)
      Converts the specified object to a string.
      Parameters:
      t - The object to convert. Can be null (returns null).
      Returns:
      The object converted to a string, or null if the object was null.
    • getChildObjectSwapForSwap

      protected ObjectSwap<?,?> getChildObjectSwapForSwap(Class<?> normalClass)
      Returns the ObjectSwap where the specified class is the same/subclass of the normal class of one of the child POJO swaps associated with this class.
      Parameters:
      normalClass - The normal class being resolved.
      Returns:
      The resolved ObjectSwap or null if none were found.
    • getChildObjectSwapForUnswap

      protected ObjectSwap<?,?> getChildObjectSwapForUnswap(Class<?> swapClass)
      Returns the ObjectSwap where the specified class is the same/subclass of the swap class of one of the child POJO swaps associated with this class.
      Parameters:
      swapClass - The swap class being resolved.
      Returns:
      The resolved ObjectSwap or null if none were found.
    • hasChildSwaps

      protected boolean hasChildSwaps()
      Returns true if this class or any child classes has a ObjectSwap associated with it.

      Used when transforming bean properties to prevent having to look up transforms if we know for certain that no transforms are associated with a bean property.

      Returns:
      true if this class or any child classes has a ObjectSwap associated with it.
    • toString

      protected StringBuilder toString(StringBuilder sb, boolean simple)
      Appends this object as a readable string to the specified string builder.
      Parameters:
      sb - The string builder to append this object to. Must not be null.
      simple - Print simple class names only (no package).
      Returns:
      The passed-in string builder.