Package org.junit.runners.model
Class FrameworkField
- java.lang.Object
- org.junit.runners.model.FrameworkMember<FrameworkField>
- org.junit.runners.model.FrameworkField
- All Implemented Interfaces:
Annotatable
public class FrameworkField extends FrameworkMember<FrameworkField>
Represents a field on a test class (currently used only for Rules inBlockJUnit4ClassRunner
, but custom runners can make other uses)- Since:
- 4.7
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
get(Object target)
Attempts to retrieve the value of this field ontarget
<T extends Annotation>
TgetAnnotation(Class<T> annotationType)
Returns the annotation on the model element of the given type, or @code{null}Annotation[]
getAnnotations()
Returns the model elements' annotations.Class<?>
getDeclaringClass()
Field
getField()
protected int
getModifiers()
String
getName()
Class<?>
getType()
boolean
isShadowedBy(FrameworkField otherMember)
String
toString()
Methods inherited from class org.junit.runners.model.FrameworkMember
isPublic, isStatic
Method Detail
getName
public String getName()
- Specified by:
getName
in classFrameworkMember<FrameworkField>
getAnnotations
public Annotation[] getAnnotations()
Description copied from interface:Annotatable
Returns the model elements' annotations.
getAnnotation
public <T extends Annotation> T getAnnotation(Class<T> annotationType)
Description copied from interface:Annotatable
Returns the annotation on the model element of the given type, or @code{null}
isShadowedBy
public boolean isShadowedBy(FrameworkField otherMember)
getModifiers
protected int getModifiers()
- Specified by:
getModifiers
in classFrameworkMember<FrameworkField>
getType
public Class<?> getType()
- Specified by:
getType
in classFrameworkMember<FrameworkField>
- Returns:
- the underlying Java Field type
- See Also:
Field.getType()
getDeclaringClass
public Class<?> getDeclaringClass()
- Specified by:
getDeclaringClass
in classFrameworkMember<FrameworkField>
get
public Object get(Object target) throws IllegalArgumentException, IllegalAccessException
Attempts to retrieve the value of this field ontarget