Modifier and Type | Method and Description |
---|---|
void |
addChildResource(Resource resource)
Add an existing Resource as a child resource of current resource.
|
Resource.Builder |
addChildResource(String relativePath)
Add a new child resource to the resource.
|
ResourceMethod.Builder |
addMethod()
Add a new arbitrary method model to the resource.
|
ResourceMethod.Builder |
addMethod(ResourceMethod resourceMethod)
Add a new method model that is a copy of the given
resourceMethod . |
ResourceMethod.Builder |
addMethod(String httpMethod)
Add a new method model to the resource for processing requests of
the specified HTTP method.
|
Resource |
build()
Build a new resource model.
|
Resource.Builder |
extended(boolean extended)
Set the flag indicating whether the resource is extended or is a core of exposed RESTful API.
|
Resource.Builder |
mergeWith(Resource.Builder resourceBuilder)
Merge methods from a given resource model builder into this resource model
builder.
|
Resource.Builder |
mergeWith(Resource resource)
Merge methods from a given resource model into this resource model builder.
|
Resource.Builder |
name(String name)
Define a new name of the built resource.
|
Resource.Builder |
path(String path)
Define a new path for the built resource.
|
void |
replaceChildResource(Resource replacedResource,
Resource newResource)
Replace an existing child resource with a newly supplied one.
|
String |
toString() |
ResourceMethod.Builder |
updateMethod(ResourceMethod resourceMethod)
Get a method builder for an existing resource method.
|
public Resource.Builder name(String name)
name
- new name of the resource.Resource.getName()
public Resource.Builder path(String path)
path
- new path for the resource.public ResourceMethod.Builder addMethod(String httpMethod)
build()
method on the method builder after setting all the data. This will be
done automatically when the resource is built.httpMethod
- HTTP method that will be processed by the method.public ResourceMethod.Builder addMethod()
build()
method on the method builder after setting all the data. This will be
done automatically when the resource is built.public ResourceMethod.Builder addMethod(ResourceMethod resourceMethod)
resourceMethod
.
The returned builder is automatically bound to the the resource. It is
not necessary to invoke the build()
method on the method builder after setting all the data. This will be
done automatically when the resource is built.resourceMethod
- The resource method based on which the new method builder
should be created.public ResourceMethod.Builder updateMethod(ResourceMethod resourceMethod)
resourceMethod
- The resource method to be replaced by a builder.IllegalArgumentException
- in case the method to be updated is not registered
in this resource builder.public Resource.Builder addChildResource(String relativePath)
build()
method on the resource builder after setting all the data. This will be
done automatically when the resource is built.relativePath
- The path of the new child resource relative to this resource.IllegalStateException
- in case the child resource for this path exists already.public void addChildResource(Resource resource)
resource
- Resource to be added as child resource.public void replaceChildResource(Resource replacedResource, Resource newResource)
replacedResource
- old resource to be replaced.newResource
- new resource to add.IllegalArgumentException
- in case there is no such child resource to be replaced.public Resource.Builder mergeWith(Resource resource)
resource
- to be merged into this resource model builder.public Resource.Builder extended(boolean extended)
Resource.isExtended()
.
Extended resource model components are helper components that are not considered as a core of a
RESTful API. These can be for example OPTIONS
resource methods
added by model processors
or application.wadl
resource producing the WADL. Both resource are rather supportive
than the core of RESTful API.
If not set the resource will not be defined as extended by default.
extended
- If true
then resource is marked as extended.ExtendedResource
public Resource.Builder mergeWith(Resource.Builder resourceBuilder)
NOTE: Any "open" method builders in the supplied resourceBuilder
that have
not been explicitly converted to method models
will be closed as part of this merge operation
before merging the resource builder instances.
resourceBuilder
- to be merged into this resource model builder.public Resource build()
Copyright © 2007-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.