com.lexicalscope.fluentreflection
Interface ReflectedClass<T>

All Superinterfaces:
ReflectedAnnotated, ReflectedType<T>

public interface ReflectedClass<T>
extends ReflectedType<T>


Method Summary
 boolean assignableFromObject(Object value)
          True if the given object can be assigned to a variable of the type represented by this class
 boolean assignableTo(Class<?> klass)
           
 ReflectedClass<?> asType(org.hamcrest.Matcher<ReflectedClass<?>> typeMatcher)
          Get this type as the first matching the supplied matcher.
 ReflectedClass<T> boxedType()
           
 ReflectedObject<T> construct(Object... args)
          Construct an object of the type under reflection
 ReflectedConstructor<T> constructor(org.hamcrest.Matcher<? super ReflectedConstructor<?>> constructorMatcher)
          Find the first constructor method matching the supplied matcher
 List<ReflectedConstructor<T>> constructors(org.hamcrest.Matcher<? super ReflectedConstructor<?>> constructorMatcher)
          Find all constructors matching the supplied matcher
 T constructRaw(Object... args)
          Construct an object of the type under reflection
 List<ReflectedClass<?>> interfaces()
          All interfaces implemented by this type
 boolean isInterface()
          True iff the type is an interface
 boolean isPrimitive()
           
 boolean isType(ReflectionMatcher<ReflectedClass<?>> typeMatcher)
          Does this type or any of its implemented types match the given matcher?
 String name()
           
 String simpleName()
           
 ReflectedMethod staticMethod(org.hamcrest.Matcher<? super ReflectedMethod> methodNamed)
          Find the first static method matching the supplied matcher
 List<ReflectedClass<?>> superclasses()
          Return the list of all superclasses with the immediate parent first
 Type type()
           
 ReflectedClass<?> typeArgument(int typeParameter)
           
 
Methods inherited from interface com.lexicalscope.fluentreflection.ReflectedType
canBeBoxed, canBeUnboxed, classUnderReflection, declaredMethods, method, method, methods, methods
 
Methods inherited from interface com.lexicalscope.fluentreflection.ReflectedAnnotated
annotatedWith, annotation, annotation
 

Method Detail

isInterface

boolean isInterface()
True iff the type is an interface

Returns:
True iff the type is an interface

interfaces

List<ReflectedClass<?>> interfaces()
All interfaces implemented by this type

Returns:
all the interfaces

superclasses

List<ReflectedClass<?>> superclasses()
Return the list of all superclasses with the immediate parent first

Returns:
list of superclasses nearest first

asType

ReflectedClass<?> asType(org.hamcrest.Matcher<ReflectedClass<?>> typeMatcher)
Get this type as the first matching the supplied matcher. This type and then the supertypes are searched

Parameters:
typeMatcher - matcher on the required type
Returns:
first matching the matcher

isType

boolean isType(ReflectionMatcher<ReflectedClass<?>> typeMatcher)
Does this type or any of its implemented types match the given matcher?

Parameters:
typeMatcher - matcher on the required type
Returns:
does the type or any of its supertypes match the given matcher

constructRaw

T constructRaw(Object... args)
Construct an object of the type under reflection

Returns:
the constructed object

construct

ReflectedObject<T> construct(Object... args)
Construct an object of the type under reflection

Returns:
a reflection wrapper around the constructed object

constructors

List<ReflectedConstructor<T>> constructors(org.hamcrest.Matcher<? super ReflectedConstructor<?>> constructorMatcher)
Find all constructors matching the supplied matcher

Parameters:
constructorMatcher - matches the constructors
Returns:

constructor

ReflectedConstructor<T> constructor(org.hamcrest.Matcher<? super ReflectedConstructor<?>> constructorMatcher)
Find the first constructor method matching the supplied matcher

Parameters:
constructorMatcher - matches the method
Returns:
The constructor matching the supplied matcher

staticMethod

ReflectedMethod staticMethod(org.hamcrest.Matcher<? super ReflectedMethod> methodNamed)
Find the first static method matching the supplied matcher

Parameters:
methodNamed - matches the method
Returns:
The method matching the supplied matcher

assignableFromObject

boolean assignableFromObject(Object value)
True if the given object can be assigned to a variable of the type represented by this class

Parameters:
value - the value that might be assigned
Returns:
true iff the value can be assigned to variables of this type

assignableTo

boolean assignableTo(Class<?> klass)

typeArgument

ReflectedClass<?> typeArgument(int typeParameter)

isPrimitive

boolean isPrimitive()

boxedType

ReflectedClass<T> boxedType()

name

String name()
Returns:
the name of the class under reflection

simpleName

String simpleName()

type

Type type()
Returns:
the underlying type instance


Copyright © 2011-2012 lexicalscope. All Rights Reserved.