Package groovy.lang

Class MissingPropertyException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
IllegalPropertyAccessException, MissingPropertyExceptionNoStack, ReadOnlyPropertyException

public class MissingPropertyException extends GroovyRuntimeException
An exception occurred if a dynamic property dispatch fails with an unknown property.

Note that the Missing*Exception classes were named for consistency and to avoid conflicts with JDK exceptions of the same name.

See Also:
  • Field Details

    • MPE

      public static final Object MPE
      Sentinel used internally when handling missing properties.
  • Constructor Details

    • MissingPropertyException

      public MissingPropertyException(String property, Class type)
      Creates an exception for a missing property.
      Parameters:
      property - the missing property name
      type - the target type
    • MissingPropertyException

      public MissingPropertyException(String property, Class type, Throwable cause)
      Creates an exception for a missing property with an underlying cause.
      Parameters:
      property - the missing property name
      type - the target type
      cause - the underlying cause
    • MissingPropertyException

      public MissingPropertyException(String message)
      Creates an exception with a custom message.
      Parameters:
      message - the detail message
    • MissingPropertyException

      public MissingPropertyException(String message, String property, Class type)
      Creates an exception with a custom message for a missing property.
      Parameters:
      message - the detail message
      property - the missing property name
      type - the target type
  • Method Details

    • getMessageWithoutLocationText

      public String getMessageWithoutLocationText()
      Returns the detail message without any location suffix.
      Overrides:
      getMessageWithoutLocationText in class GroovyRuntimeException
      Returns:
      the formatted detail message
    • getProperty

      public String getProperty()
      Returns:
      the name of the property that could not be found
    • getType

      public Class getType()
      Returns:
      the class which cannot answer the property