Interface ResourceAware


public interface ResourceAware
Implemented by objects that want the Resource they originate from to be injected into them.

When Camel creates an object from a resource (for example a route loaded from a file), it sets the originating Resource on the object if it implements this interface, so the object can later refer back to where it came from. The trySetResource(Object, Resource) helper performs this injection conditionally.

Since:
3.17
See Also:
  • Method Details

    • trySetResource

      static <T> T trySetResource(T object, Resource resource)
      Set the Resource resource if the object is an instance of ResourceAware.
    • getResource

      @Nullable Resource getResource()
      Gets the Resource.
      Returns:
      the resource, or null if none is set
    • setResource

      void setResource(Resource resource)
      Sets the Resource.
      Parameters:
      resource - the resource