org.junit.runners.model
Class FrameworkField
java.lang.Objectorg.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 in BlockJUnit4ClassRunner
, but custom runners can make other uses)
- Since:
- 4.7
Constructor Summary | |
---|---|
FrameworkField(Field field) Returns a new FrameworkField for field . |
Method Summary | ||
---|---|---|
Object |
get(Object target) Attempts to retrieve the value of this field on target |
|
|
getAnnotation(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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
FrameworkField
public FrameworkField(Field field)
-
Returns a new
FrameworkField
forfield
.Access relaxed to
public
since version 4.13.1.
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>
-
getField
public Field getField()
-
- Returns:
- the underlying java Field
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 on
target
toString
public String toString()