Package org.forgerock.api.annotations
Annotation Interface Path
Allocate a path to a component.
This annotation can be applied to either a method or a type:
-
Method - the method should return a handleable type - i.e. either a
RequestHandler
, an annotated POJO, or an implementation of a resource handler interface. This will expose the returned object as a subpath beneath the handler that the method is a member of. -
Type - declare the path of a handleable type, so that the path does not have to be declared in a separate
interaction with a router. Note that if the
@Path
-annotated handleable type is returned from a method on another type also annotated with@Path
, then the type annotation is ignored.
Example:
@RequestHandler(variant = COLLECTION_RESOURCE)
@Path("things")
public class ThingProducer {
@Read
public Promise<ResourceResponse, ResourceException> get(String id) {
// ...
}
@Path("{thing}/subthing")
public SubthingProducer subthing() {
return new SubthingProducer();
}
}
@RequestHandler(variant = SINGLETON_RESOURCE)
public class SubthingProducer {
@Read
public Promise<ResourceResponse, ResourceException> get() {
// ...
}
}
In this example, when an instance of ThingProducer
would result in the following paths being created:
/things
- collection binding toThingProducer
/things/{id}
- instance binding toThingProducer
/things/{thing}/subthing
- singleton binding toSubthingProducer
-
Required Element Summary
-
Element Details
-
value
String valueThe path value.
-