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 newFrameworkField
forfield
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
get(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.Field
getField()
protected int
getModifiers()
java.lang.String
getName()
java.lang.Class<?>
getType()
boolean
isShadowedBy(FrameworkField otherMember)
java.lang.String
toString()
-
Methods inherited from class org.junit.runners.model.FrameworkMember
isPublic, isStatic
-
-
-
-
Constructor Detail
-
FrameworkField
public FrameworkField(java.lang.reflect.Field field)
Returns a newFrameworkField
forfield
.Access relaxed to
public
since version 4.13.1.
-
-
Method Detail
-
getName
public java.lang.String getName()
- Specified by:
getName
in classFrameworkMember<FrameworkField>
-
getAnnotations
public java.lang.annotation.Annotation[] getAnnotations()
Description copied from interface:Annotatable
Returns the model elements' annotations.
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.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>
-
getField
public java.lang.reflect.Field getField()
- Returns:
- the underlying java Field
-
getType
public java.lang.Class<?> getType()
- Specified by:
getType
in classFrameworkMember<FrameworkField>
- Returns:
- the underlying Java Field type
- See Also:
Field.getType()
-
getDeclaringClass
public java.lang.Class<?> getDeclaringClass()
- Specified by:
getDeclaringClass
in classFrameworkMember<FrameworkField>
-
get
public java.lang.Object get(java.lang.Object target) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
Attempts to retrieve the value of this field ontarget
- Throws:
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-