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
-
-
Constructor Summary
Constructors Constructor Description FrameworkField(java.lang.reflect.Field field)Returns a newFrameworkFieldforfield.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectget(java.lang.Object target)Attempts to retrieve the value of this field ontarget<T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> annotationType)Returns the annotation on the model element of the given type, or @code{null}java.lang.annotation.Annotation[]getAnnotations()Returns the model elements' annotations.java.lang.Class<?>getDeclaringClass()java.lang.reflect.FieldgetField()protected intgetModifiers()java.lang.StringgetName()java.lang.Class<?>getType()booleanisShadowedBy(FrameworkField otherMember)java.lang.StringtoString()-
Methods inherited from class org.junit.runners.model.FrameworkMember
isPublic, isStatic
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
- Specified by:
getNamein classFrameworkMember<FrameworkField>
-
getAnnotations
public java.lang.annotation.Annotation[] getAnnotations()
Description copied from interface:AnnotatableReturns the model elements' annotations.
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationType)
Description copied from interface:AnnotatableReturns 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:
getModifiersin classFrameworkMember<FrameworkField>
-
getField
public java.lang.reflect.Field getField()
- Returns:
- the underlying java Field
-
getType
public java.lang.Class<?> getType()
- Specified by:
getTypein classFrameworkMember<FrameworkField>- Returns:
- the underlying Java Field type
- See Also:
Field.getType()
-
getDeclaringClass
public java.lang.Class<?> getDeclaringClass()
- Specified by:
getDeclaringClassin classFrameworkMember<FrameworkField>
-
get
public java.lang.Object get(java.lang.Object target) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessExceptionAttempts to retrieve the value of this field ontarget- Throws:
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-