FrameworkField (JUnit API)
Date: 2018-08-04

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 in `BlockJUnit4ClassRunner`, but custom runners can make other uses)
  Since:
    4.7

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `get(java.lang.Object target)` Attempts to retrieve the value of this field on `target`
    `<T extends java.lang.annotation.Annotation> T` | `getAnnotation(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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Specified by:
        `getName` in class `FrameworkMember<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 class `FrameworkMember<FrameworkField>`

    - #### getField

          public java.lang.reflect.Field getField()

      Returns:
        the underlying java Field

    - #### getType

          public java.lang.Class<?> getType()

      Specified by:
        `getType` in class `FrameworkMember<FrameworkField>`
      Returns:
        the underlying Java Field type
      See Also:
        `Field.getType()`

    - #### getDeclaringClass

          public java.lang.Class<?> getDeclaringClass()

      Specified by:
        `getDeclaringClass` in class `FrameworkMember<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 on `target`
      Throws:
        `java.lang.IllegalArgumentException`
        `java.lang.IllegalAccessException`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`