Package org.apache.camel.spi
Class TypeConvertible<F,T>
java.lang.Object
org.apache.camel.spi.TypeConvertible<F,T>
- Type Parameters:
F- The "from" typeT- The "to" type.
Holds a type convertible pair. That is, consider 2 types defined as F and T, it defines that F can be converted to T.
-
Constructor Summary
ConstructorsConstructorDescriptionTypeConvertible(Class<F> from, Class<T> to) Constructs a new type convertible pair. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetFrom()Gets the class instance that defines the "from" type (that is: Class<F>.class)getTo()Gets the class instance that defines the "to" type (that is: Class<F>.class).inthashCode()booleanisAssignableMatch(TypeConvertible<?, ?> that) Tests whether the types defined in this type convertable pair are assignable from another type convertable pairbooleanmatches(TypeConvertible<?, ?> that) Tests whether there is a conversion match from this TypeConvertible to the given TypeConvertible.booleanmatchesPrimitive(TypeConvertible<?, ?> that) Tests whether there is a conversion match from this TypeConvertible to the given TypeConvertible when the "to" type of the tested TypeConvertible is a primitive type.toString()
-
Constructor Details
-
TypeConvertible
Constructs a new type convertible pair. This is likely only used by core camel code and auto-generated bulk loaders. This is an internal API and not meant for end users.- Parameters:
from- The class instance that defines the "from" type (that is: Class<F>.class). Must NOT be null.to- The class instance that defines the "to" type (that is: Class<F>.class). Must NOT be null.
-
-
Method Details
-
matches
Tests whether there is a conversion match from this TypeConvertible to the given TypeConvertible. For instance, consider 2 TypeConvertibles defined as "tc1{from: Number.class, to: String.class}" and "tc2{from: Integer.class, to: String.class}", it traverses the type hierarchy of the "from" class to determine if it, or any of its superclasses or any of its interfaces match with the "from" type of this instance.- Parameters:
that- the TypeConvertible being tested against this instance- Returns:
- true if there is a conversion match between the give TypeConvertible and this instance.
-
matchesPrimitive
Tests whether there is a conversion match from this TypeConvertible to the given TypeConvertible when the "to" type of the tested TypeConvertible is a primitive type. Seematches(TypeConvertible)for details.- Parameters:
that- the TypeConvertible being tested against this instance- Returns:
- true if there is a conversion match between the give TypeConvertible and this instance.
-
isAssignableMatch
Tests whether the types defined in this type convertable pair are assignable from another type convertable pair- Parameters:
that- the type convertible pair to test- Returns:
- true if the types in this instance are assignable from the respective types in the given type convertible
-
equals
-
hashCode
public int hashCode() -
getFrom
Gets the class instance that defines the "from" type (that is: Class<F>.class)- Returns:
- the "from" class instance
-
getTo
Gets the class instance that defines the "to" type (that is: Class<F>.class).- Returns:
- the "to" class instance
-
toString
-