Class PropertyNotFoundException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.apache.juneau.junit.bct.PropertyNotFoundException
All Implemented Interfaces:
Serializable

Exception thrown when a requested property cannot be found on an object.

This exception is typically thrown by PropertyExtractor implementations when attempting to access a property that does not exist on the target object.

Examples:

// Property extraction that may throw PropertyNotFoundException try { String value = converter.getNested(object, tokenize("nonExistentProperty").get(0)); } catch (PropertyNotFoundException e) { // Handle missing property gracefully System.err.println("Property not found: " + e.getMessage()); }

// Testing for PropertyNotFoundException assertThrows(PropertyNotFoundException.class, () -> { converter.getNested(bean, tokenize("invalidField").get(0)); });

See Also:
  • Constructor Details

    • PropertyNotFoundException

      Constructs a new PropertyNotFoundException with the specified detail message.
      Parameters:
      message - The detail message describing the missing property
    • PropertyNotFoundException

      public PropertyNotFoundException(String message, Throwable cause)
      Constructs a new PropertyNotFoundException with the specified detail message and cause.
      Parameters:
      message - The detail message describing the missing property
      cause - The underlying cause of the exception
    • PropertyNotFoundException

      public PropertyNotFoundException(String propertyName, Class<?> objectType)
      Constructs a new PropertyNotFoundException for a specific property name and object type.
      Parameters:
      propertyName - The name of the property that could not be found
      objectType - The type of object on which the property was sought
    • PropertyNotFoundException

      public PropertyNotFoundException(String propertyName, Class<?> objectType, Throwable cause)
      Constructs a new PropertyNotFoundException for a specific property name and object type with a cause.
      Parameters:
      propertyName - The name of the property that could not be found
      objectType - The type of object on which the property was sought
      cause - The underlying cause of the exception