org.beanfabrics.util
Class VariableMapping

java.lang.Object
  extended by org.beanfabrics.util.VariableMapping

public class VariableMapping
extends java.lang.Object

The VariableMapping maps type variables to type values.


Constructor Summary
VariableMapping()
          Creates an empty variable mapping.
VariableMapping(VariableMapping aParentMapping)
          Creates a copy of the given variable mapping.
VariableMapping(VariableMapping aParentMapping, java.lang.reflect.ParameterizedType parameterizedType)
          Creates a copy of the given variable mapping and populates it with the type variable mapping of the given parameterized type.
 
Method Summary
 boolean isMapped(java.lang.reflect.TypeVariable<?> variable)
          Returns true if the given variable is mapped to some value.
 java.lang.reflect.Type resolve(java.lang.reflect.TypeVariable<?> variable)
          Resolves the mapped value of the given variable.
 java.lang.reflect.Type tryResolve(java.lang.reflect.TypeVariable<?> var)
          Tries to resolve the mapped value of the given variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableMapping

public VariableMapping()
Creates an empty variable mapping.


VariableMapping

public VariableMapping(VariableMapping aParentMapping)
Creates a copy of the given variable mapping.

Parameters:
aParentMapping -

VariableMapping

public VariableMapping(VariableMapping aParentMapping,
                       java.lang.reflect.ParameterizedType parameterizedType)
Creates a copy of the given variable mapping and populates it with the type variable mapping of the given parameterized type.

Parameters:
aParentMapping -
parameterizedType -
Method Detail

isMapped

public boolean isMapped(java.lang.reflect.TypeVariable<?> variable)
Returns true if the given variable is mapped to some value.

Parameters:
variable -
Returns:
true if the given variable is mapped to some value

resolve

public java.lang.reflect.Type resolve(java.lang.reflect.TypeVariable<?> variable)
Resolves the mapped value of the given variable. Returns the mapped value.

Parameters:
variable - the variable to resolve
Returns:
the value that is mapped to this variable

tryResolve

public java.lang.reflect.Type tryResolve(java.lang.reflect.TypeVariable<?> var)
Tries to resolve the mapped value of the given variable. Returns the mapped value if a mapping is found, or the variable itself, if it is not found.

Parameters:
var -
Returns: