Package groovy.lang

# Class MissingFieldException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
groovy.lang.GroovyRuntimeException
groovy.lang.MissingFieldException

All Implemented Interfaces:
  `Serializable`

public class MissingFieldException extends GroovyRuntimeException
An exception occurred if a dynamic field dispatch fails with an unknown field. Note that the Missing*Exception classes were named for consistency and to avoid conflicts with JDK exceptions of the same name.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MissingFieldException(String field, Class type)`
  Creates an exception for a missing field.
  `MissingFieldException(String field, Class type, Throwable e)`
  Creates an exception for a missing field with an underlying cause.
  `MissingFieldException(String message, String field, Class type)`
  Creates an exception with a custom message for a missing field.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getField()`
  `Class`
  `getType()`

  ### Methods inherited from class groovy.lang.GroovyRuntimeException

  `getLocationText, getMessage, getMessageWithoutLocationText, getModule, getNode, setModule`

  ### Methods inherited from class java.lang.Throwable

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

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

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

- ## Constructor Details

  - ### MissingFieldException

    public MissingFieldException(String field, Class type)
    Creates an exception for a missing field.
    Parameters:
      `field` - the missing field name
      `type` - the target type

  - ### MissingFieldException

    public MissingFieldException(String field, Class type, Throwable e)
    Creates an exception for a missing field with an underlying cause.
    Parameters:
      `field` - the missing field name
      `type` - the target type
      `e` - the underlying cause

  - ### MissingFieldException

    public MissingFieldException(String message, String field, Class type)
    Creates an exception with a custom message for a missing field.
    Parameters:
      `message` - the detail message
      `field` - the missing field name
      `type` - the target type

- ## Method Details

  - ### getField

    public String getField()
    Returns:
      the name of the field that could not be found

  - ### getType

    public Class getType()
    Returns:
      The type on which the field was attempted to be called