Class TypedValue

java.lang.Object
org.springframework.expression.TypedValue
Direct Known Subclasses:
BooleanTypedValue

public class TypedValue extends Object
Encapsulates an object and a TypeDescriptor that describes it.

The type descriptor can contain generic declarations that would not be accessible through a simple getClass() call on the object.

Since:
3.0
Author:
Andy Clement, Juergen Hoeller
  • Field Details

  • Constructor Details

    • TypedValue

      public TypedValue(@Nullable Object value)
      Create a TypedValue for a simple object. The TypeDescriptor is inferred from the object, so no generic declarations are preserved.
      Parameters:
      value - the object value
    • TypedValue

      public TypedValue(@Nullable Object value, @Nullable org.springframework.core.convert.TypeDescriptor typeDescriptor)
      Create a TypedValue for a particular value with a particular TypeDescriptor which may contain additional generic declarations.
      Parameters:
      value - the object value
      typeDescriptor - a type descriptor describing the type of the value
  • Method Details

    • getValue

      @Nullable public Object getValue()
    • getTypeDescriptor

      @Nullable public org.springframework.core.convert.TypeDescriptor getTypeDescriptor()
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object