protected static <AdapterType> AdapterType getAdapter(Resource resource, Class<AdapterType> type) {
        if (type == ResourceHandle.class) {
            return type.cast(new ResourceHandle(resource));
        }
        log.info("Unable to adapt resource on {} to type {}", resource.getPath(), type.getName());
        return null;
    }
protected static < AdapterType > AdapterType getAdapter ( Resource resource , Class < AdapterType > type ) { if ( type == ResourceHandle . class ) { return type . cast ( new ResourceHandle ( resource ) ) ; } log . info ( "Unable to adapt resource on {} to type {}" , resource . getPath ( ) , type . getName ( ) ) ; return null ; }
Handles <code>resource.adaptTo(ResourceHandle.class)</code>, to wrap a resource with an ResourceHandle.

@param resource resource to adapt/wrap
@param type target type
@return wrapped resource