This project has retired. For details please refer to its Attic page.
Apache REEF: Org.Apache.REEF.Tang.Util.ReflectionUtilities Class Reference
Apache REEF  0.15.0
Retainable Evaluator Execution Framework
Static Public Member Functions | Static Public Attributes | List of all members
Org.Apache.REEF.Tang.Util.ReflectionUtilities Class Reference

Static Public Member Functions

static string GetAssemblyQualifiedName (Type name)
 Gets the AssemblyQualifiedName from the Type. More...
 
static string GetName (Type name)
 It returns Type.FullName. More...
 
static Type GetInterfaceTarget (Type iface, Type type)
 Gets the interface target. More...
 
static Type GetInterfaceTargetForType (Type iface, Type type)
 
static bool IsGenericTypeof (Type iface, Type type)
 Determines whether [is generic typeof] [the specified iface]. More...
 
static IEnumerable< Type > ClassAndAncestors (Type c)
 Classes the and ancestors. More...
 
static IEnumerable< Type > ClassAndAncestorsExcludeSelf (Type c)
 
static Type BoxClass (Type c)
 Boxes the class. More...
 
static bool IsCoercable (Type to, Type from)
 Determines whether the specified to is coercable. More...
 
static bool IsAssignableFromIgnoreGeneric (Type to, Type from)
 Determines whether [is assignable from ignore generic] [the specified to]. More...
 
static Type EnsureInterfaceType (Type interf)
 Ensures the type of the interface. More...
 
static string GetAssemblyQualifiedNameForGeneric (Type t)
 Gets the assembly qualified name for generic. More...
 
static bool IsInstanceOfGeneric (object p, Type t)
 Determines whether [is instance of generic] [the specified p]. More...
 
static Type GetTypeByName (string name)
 Gets the name of the type by. More...
 
static Type[] GetEnclosingClasses (Type t)
 Gets the enclosing classes. More...
 
static string[] GetEnclosingClassNames (Type t)
 Gets the enclosing class names. More...
 
static string[] GetEnclosingClassNames (string fullName)
 Gets the enclosing class names. More...
 
static Type GetNamedParameterTargetOrNull (Type type)
 Gets the named parameter target or null. More...
 
static IEnumerable< Type > GetInterfaces (Type type, bool includeInherited)
 
static bool IsAnonymousType (Type type)
 

Static Public Attributes

static readonly string Regexp = "[\\.\\+]"
 

Member Function Documentation

static Type Org.Apache.REEF.Tang.Util.ReflectionUtilities.BoxClass ( Type  c)
inlinestatic

Boxes the class.

Parameters
cThe c.
Returns
Exceptions
System.NotSupportedExceptionEncountered unknown primitive type!
static IEnumerable<Type> Org.Apache.REEF.Tang.Util.ReflectionUtilities.ClassAndAncestors ( Type  c)
inlinestatic

Classes the and ancestors.

Parameters
cThe c.
Returns
static IEnumerable<Type> Org.Apache.REEF.Tang.Util.ReflectionUtilities.ClassAndAncestorsExcludeSelf ( Type  c)
inlinestatic
static Type Org.Apache.REEF.Tang.Util.ReflectionUtilities.EnsureInterfaceType ( Type  interf)
inlinestatic

Ensures the type of the interface.

For generic types, full name could be null. In this case, we need to get GetGenericTypeDefinition for the type so that to retain all teh type information

Parameters
interfThe interf.
Returns
static string Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetAssemblyQualifiedName ( Type  name)
inlinestatic

Gets the AssemblyQualifiedName from the Type.

This name is used in ClassHierarchy as a key when add a node as a child to parent. THe name is used as FullName in a Node

Parameters
nameThe name.
Returns
Exceptions
System.ArgumentExceptionnull is passed in FullName() in ReflectionUtilities
static string Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetAssemblyQualifiedNameForGeneric ( Type  t)
inlinestatic

Gets the assembly qualified name for generic.

Parameters
tThe t.
Returns
static Type [] Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetEnclosingClasses ( Type  t)
inlinestatic

Gets the enclosing classes.

Parameters
tThe t.
Returns
static string [] Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetEnclosingClassNames ( Type  t)
inlinestatic

Gets the enclosing class names.

Parameters
tThe t.
Returns
Exceptions
System.ApplicationExceptionThe Type passed to GetEnclosingClassShortNames is null
static string [] Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetEnclosingClassNames ( string  fullName)
inlinestatic

Gets the enclosing class names.

Parameters
fullNameThe full name.
Returns
Exceptions
System.ApplicationExceptionThe name passed to GetEnclosingClassShortNames is null
static IEnumerable<Type> Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetInterfaces ( Type  type,
bool  includeInherited 
)
inlinestatic
static Type Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetInterfaceTarget ( Type  iface,
Type  type 
)
inlinestatic

Gets the interface target.

Foo<T> , given Foo<T> and Foo return T example class Foo : Bar<U>, Bas<T> iface: Bar, type: Foo, return U iface: Bas, type: Foo, return T class ACons implements IExternalConstructor iface: IExternalConstructor<>, type: ACons return A

Parameters
ifaceThe iface.
typeThe type.
Returns
static Type Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetInterfaceTargetForType ( Type  iface,
Type  type 
)
inlinestatic
static string Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetName ( Type  name)
inlinestatic

It returns Type.FullName.

This name is used as Name in a Node. It is not unique for a generic type with different type of arguments. It is used for toString or debug info as AssemblyQualifiedName is really long

Parameters
nameThe name.
Returns
static Type Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetNamedParameterTargetOrNull ( Type  type)
inlinestatic

Gets the named parameter target or null.

Parameters
typeThe type.
Returns
Exceptions
ClassHierarchyExceptionNamed parameter + GetName(type) + implements
  • multiple interfaces. It is only allowed to implement Name
static Type Org.Apache.REEF.Tang.Util.ReflectionUtilities.GetTypeByName ( string  name)
inlinestatic

Gets the name of the type by.

Parameters
nameThe name.
Returns
Exceptions
System.ApplicationExceptionNot able to get Type from the name provided: + name
static bool Org.Apache.REEF.Tang.Util.ReflectionUtilities.IsAnonymousType ( Type  type)
inlinestatic
static bool Org.Apache.REEF.Tang.Util.ReflectionUtilities.IsAssignableFromIgnoreGeneric ( Type  to,
Type  from 
)
inlinestatic

Determines whether [is assignable from ignore generic] [the specified to].

Parameters
toTo.
fromFrom.
Returns
true if [is assignable from ignore generic] [the specified to]; otherwise, false.
static bool Org.Apache.REEF.Tang.Util.ReflectionUtilities.IsCoercable ( Type  to,
Type  from 
)
inlinestatic

Determines whether the specified to is coercable.

Parameters
toTo.
fromFrom.
Returns
true if the specified to is coercable; otherwise, false.
static bool Org.Apache.REEF.Tang.Util.ReflectionUtilities.IsGenericTypeof ( Type  iface,
Type  type 
)
inlinestatic

Determines whether [is generic typeof] [the specified iface].

Parameters
ifaceThe iface.
typeThe type.
Returns
true if [is generic typeof] [the specified iface]; otherwise, false.
Exceptions
System.ApplicationException
static bool Org.Apache.REEF.Tang.Util.ReflectionUtilities.IsInstanceOfGeneric ( object  p,
Type  t 
)
inlinestatic

Determines whether [is instance of generic] [the specified p].

Parameters
pThe p.
tThe t.
Returns
true if [is instance of generic] [the specified p]; otherwise, false.

Member Data Documentation

readonly string Org.Apache.REEF.Tang.Util.ReflectionUtilities.Regexp = "[\\.\\+]"
static

The documentation for this class was generated from the following file: