public final class ModelProcessorUtil extends Object
model processors
.Modifier and Type | Class and Description |
---|---|
static class |
ModelProcessorUtil.Method
Method bean containing basic information about enhancing resource method.
|
Modifier and Type | Method and Description |
---|---|
static void |
enhanceResource(RuntimeResource resource,
ResourceModel.Builder enhancedModelBuilder,
List<ModelProcessorUtil.Method> methods,
boolean extended)
Enhance the runtime resource referenced by
resource parameter with a list of additional methods. |
static ResourceModel.Builder |
enhanceResourceModel(ResourceModel resourceModel,
boolean subResourceModel,
List<ModelProcessorUtil.Method> methods,
boolean extendedFlag)
Enhance
resourceModel with a list of additional methods. |
static Set<String> |
getAllowedMethods(RuntimeResource resource)
Return allowed methods for the given
resource . |
public static Set<String> getAllowedMethods(RuntimeResource resource)
resource
. OPTIONS and HEAD are always returned in the result.resource
- Resource for which resource methods should be found.public static ResourceModel.Builder enhanceResourceModel(ResourceModel resourceModel, boolean subResourceModel, List<ModelProcessorUtil.Method> methods, boolean extendedFlag)
resourceModel
with a list of additional methods.
The resourceModel
is traversed and for each available runtime resource URI in the model methods
are added.
In case of method conflicts, the existing resource methods will be preserved and will not be 'overridden' by any new
method from the methods
list. Overriding check takes into account media types of methods so
that new resource methods with same HTTP method can be defined only for a more more specific media type.resourceModel
- Resource model to be enhanced.subResourceModel
- true
if the resourceModel
to be enhanced is a sub resource model, false
if it is application resource model.methods
- List of enhancing methods.extendedFlag
- This flag will initialize the property
ResourceMethod.isExtended()
.methods
.public static void enhanceResource(RuntimeResource resource, ResourceModel.Builder enhancedModelBuilder, List<ModelProcessorUtil.Method> methods, boolean extended)
resource
parameter with a list of additional methods.
The new methods
are added to the runtime resource. In case of method conflicts, the existing resource methods
will be preserved and will not be 'overridden' by any new method from the methods
list.
Overriding check takes into account media types of methods so that new resource methods with same HTTP method
can be defined only for a more more specific media type.resource
- Runtime resource to be enhanced.enhancedModelBuilder
- Builder for the enhanced resource model to be used.methods
- List of enhancing methods.extended
- This flag will initialize the property
ResourceMethod.isExtended()
.Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.