Package org.cometd.annotation.server
Class ServerAnnotationProcessor
java.lang.Object
org.cometd.annotation.AnnotationProcessor
org.cometd.annotation.server.ServerAnnotationProcessor
Processes annotations in server-side service objects.
Service objects must be annotated with Service at class level to be processed by this processor,
for example:
@Service
public class MyService
{
@Session
private ServerSession session;
@Configure("/foo")
public void configureFoo(ConfigurableServerChannel channel)
{
channel.setPersistent(...);
channel.addListener(...);
channel.addAuthorizer(...);
}
@Listener("/foo")
public void handleFooMessages(ServerSession remote, ServerMessage.Mutable message)
{
// Do something
}
}
The processor is used in this way:
BayeuxServer bayeux = ...; ServerAnnotationProcessor processor = ServerAnnotationProcessor.get(bayeux); MyService s = new MyService(); processor.process(s);
-
Constructor Summary
ConstructorsConstructorDescriptionServerAnnotationProcessor(org.cometd.bayeux.server.BayeuxServer bayeuxServer) ServerAnnotationProcessor(org.cometd.bayeux.server.BayeuxServer bayeuxServer, Object... injectables) -
Method Summary
Modifier and TypeMethodDescriptionbooleanPerforms the opposite processing done byprocess(Object)on callbacks methods annotated withListener,SubscriptionandRemoteCall, and on lifecycle methods annotated withPreDestroy.booleandeprocessCallbacks(Object bean) Performs the opposite processing done byprocessCallbacks(Object)on callback methods annotated withListener,SubscriptionandRemoteCall.booleanProcesses dependencies annotated withInjectandSession, configuration methods annotated withConfigure, callback methods annotated withListener,SubscriptionandRemoteCall, and lifecycle methods annotated withPostConstruct.booleanprocessCallbacks(Object bean) booleanprocessConfigurations(Object bean) Processes the methods annotated withConfigure.booleanprocessDependencies(Object bean) Processes the dependencies annotated withInjectandSession.booleanprocessPostConstruct(Object bean) Processes lifecycle methods annotated withPostConstruct.booleanprocessPreDestroy(Object bean) Processes lifecycle methods annotated withPreDestroy.Methods inherited from class org.cometd.annotation.AnnotationProcessor
callPublic, checkMethodsPublic, checkSignaturesMatch, findAnnotatedMethods, getField, invokePrivate, invokePublic, processInjectable, processInjectables, processParameters, setField
-
Constructor Details
-
ServerAnnotationProcessor
public ServerAnnotationProcessor(org.cometd.bayeux.server.BayeuxServer bayeuxServer) -
ServerAnnotationProcessor
public ServerAnnotationProcessor(org.cometd.bayeux.server.BayeuxServer bayeuxServer, Object... injectables)
-
-
Method Details
-
process
Processes dependencies annotated withInjectandSession, configuration methods annotated withConfigure, callback methods annotated withListener,SubscriptionandRemoteCall, and lifecycle methods annotated withPostConstruct.- Parameters:
bean- the annotated service instance- Returns:
- true if the bean contains at least one annotation that has been processed, false otherwise
-
processConfigurations
Processes the methods annotated withConfigure.- Parameters:
bean- the annotated service instance- Returns:
- true if at least one annotated configure has been processed, false otherwise
-
processDependencies
Processes the dependencies annotated withInjectandSession.- Parameters:
bean- the annotated service instance- Returns:
- true if at least one annotated dependency has been processed, false otherwise
-
processPostConstruct
Processes lifecycle methods annotated withPostConstruct.- Overrides:
processPostConstructin classAnnotationProcessor- Parameters:
bean- the annotated service instance- Returns:
- true if at least one lifecycle method has been invoked, false otherwise
-
processCallbacks
- Parameters:
bean- the annotated service instance- Returns:
- true if at least one annotated callback has been processed, false otherwise
-
deprocess
Performs the opposite processing done byprocess(Object)on callbacks methods annotated withListener,SubscriptionandRemoteCall, and on lifecycle methods annotated withPreDestroy.- Parameters:
bean- the annotated service instance- Returns:
- true if at least one deprocessing has been performed, false otherwise
- See Also:
-
deprocessCallbacks
Performs the opposite processing done byprocessCallbacks(Object)on callback methods annotated withListener,SubscriptionandRemoteCall.- Parameters:
bean- the annotated service instance- Returns:
- true if the at least one callback has been deprocessed
-
processPreDestroy
Processes lifecycle methods annotated withPreDestroy.- Overrides:
processPreDestroyin classAnnotationProcessor- Parameters:
bean- the annotated service instance- Returns:
- true if at least one lifecycle method has been invoked, false otherwise
-