@Retention(RUNTIME) @Target(ANNOTATION_TYPE) public @interface NamedServiceDefinition
@
URLStreamHandlerRegistration annotation uses the NamedServiceDefinition
as:
@NamedServiceDefinition(path="URLStreamHandler/@protocol()", serviceType=URLStreamHandler.class)
The above instructs the annotation processor that handles NamedServiceDefinition
s
to verify the annotated type is subclass of URLStreamHandler
and
if so, register it into URLStreamHandler/@protocol
where the
value of @protocol()
is replaced by the value of annotation's
protocol attribute. The registration can later be found by using
Lookups.forPath("URLStreamHandler/ftp")
(in case the protocol was ftp).ServiceProvider.path()
Modifier and Type | Required Element | Description |
---|---|---|
String |
path |
Path to register the annotation to, so it can later be found by
using
Lookups.forPath(theSamePath) . |
Class<?>[] |
serviceType |
Type, or array of types that the registered type
has to implement.
|
Class<?>[] serviceType
String path
Lookups.forPath(theSamePath)
.
The path may reference attributes of the annotated annotation by prefixing
them with @
. To reuse attribute named location
one
can for example use "how/to/get/to/@location()s/please"
These attributes must be of type String
or array of String
s (then one registration is performed
per each string in the array).String position
int position()
attribute in the defined annotation
and use it to specify the order of registrations. In case a different
attribute should be used to specify the position, one can be provide its
name by specifying non-default here. Should the position be ignored,
specify empty string.name
- of attribute in the annotated annotation to use for defining
position of the registration. The attribute should return int value.Built on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.