com.holonplatform.jaxrs.server

## Class ResourceUtils

- java.lang.Object
- - com.holonplatform.jaxrs.server.ResourceUtils

- All Implemented Interfaces:
    Serializable

      public final class ResourceUtils
      extends Object
      implements Serializable

  Utility class to handle generic resources within a JAX-RS server context.
  Since:
    5.0.0
  See Also:
    Serialized Form

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <R> Optional<R>` | `lookupResource(Class<?> caller, Class<R> resourceType, javax.ws.rs.ext.Providers providers)` Lookup a resource of given `resourceType` type, either using a suitable `ContextResolver` if `providers` is not `null` and a `ContextResolver` for given `resourceType` is available, or trying to obtain the resource from `Context` using given `resourceType` as context resource key.

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

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### lookupResource

          public static <R> Optional<R> lookupResource(Class<?> caller,
                                                       Class<R> resourceType,
                                                       javax.ws.rs.ext.Providers providers)

      Lookup a resource of given `resourceType` type, either using a suitable `ContextResolver` if `providers` is not `null` and a `ContextResolver` for given `resourceType` is available, or trying to obtain the resource from `Context` using given `resourceType` as context resource key.
      Type Parameters:
        `R` - Resource type
      Parameters:
        `caller` - Caller class
        `resourceType` - Resource type to lookup (not null)
        `providers` - JAX-RS `Providers`, if available
      Returns:
        Resource instance, or an empty optional if not available

Copyright © 2019 The Holon Platform. All rights reserved.