Package org.immutables.metainf
Annotation Type Metainf.Service
-
@Documented @Retention(SOURCE) public static @interface Metainf.ServiceMETA-INF/services/<interface.fully.qualified.name>entries in classpath will be generated with fully qualified name of annotated class as content line. Multiple meta-services by the same interface will end up on separate lines in the same meta-inf service file.Most other such generators either allow only single service type to be specified or just do autodetection of all interfaces. This generator supports autodetection of implemented inter (the default) or to override with one or more specific interfaces or classes.
package a; @Provider @Metainf.Service public class JaxrsMessageBodyProvider implements MessageBodyReader<Object>, MessageBodyWriter<Object> { ... }BothMETA-INF/services/javax.ws.rs.ext.MessageBodyReaderandMETA-INF/services/javax.ws.rs.ext.MessageBodyWriterwill be generated and will contain line with fully qualified class name ofa.JaxrsMessageBodyProvider.package b; @Provider @Metainf.Service(javax.ws.rs.ext.MessageBodyReader.class) public class JaxrsMessageBodyReader extends JaxrsMessageBodyProvider { ... }OnlyMETA-INF/services/javax.ws.rs.ext.MessageBodyReaderwill be generated and will containb.JaxrsMessageBodyReaderline. IfJaxrsMessageBodyReaderandJaxrsMessageBodyProviderwill be compiled together, thenMETA-INF/services/javax.ws.rs.ext.MessageBodyReaderfile will have merged content, i.e. it will contain two lines:a.JaxrsMessageBodyProvider b.JaxrsMessageBodyReader
- See Also:
value(),ServiceLoader,ServiceLoader.load(Class)
-
-
Element Detail
-
value
java.lang.Class<?>[] value
Ifvalue()attribute is empty (as by default) all implemented interfaces will be taken into account, otherwise only specified implemented classes will be used.- Returns:
- service interfaces or abstract classes.
- Default:
- {}
-
-