Package org.cometd.annotation.client
Class ClientAnnotationProcessor
java.lang.Object
org.cometd.annotation.AnnotationProcessor
org.cometd.annotation.client.ClientAnnotationProcessor
public class ClientAnnotationProcessor extends AnnotationProcessor
Processes annotations in client-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
{
@Listener(Channel.META_CONNECT)
public void metaConnect(Message message)
{
// Do something
}
}
The processor is used in this way:
ClientSession bayeux = ...; ClientAnnotationProcessor processor = ClientAnnotationProcessor.get(bayeux); MyService s = new MyService(); processor.process(s);
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ClientAnnotationProcessor(ClientSession clientSession)ClientAnnotationProcessor(ClientSession clientSession, Object... injectables) -
Method Summary
Modifier and Type Method Description booleandeprocess(Object bean)Performs the opposite processing done byprocess(Object)on callbacks methods annotated withListenerandSubscription, and on lifecycle methods annotated withPreDestroy.booleandeprocessCallbacks(Object bean)Performs the opposite processing done byprocessCallbacks(Object)on callback methods annotated withListenerandSubscription.booleanprocess(Object bean)Processes dependencies annotated withSession, callbacks annotated withListenerandSubscriptionand lifecycle methods annotated withPostConstruct.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
-
Method Details
-
process
Processes dependencies annotated withSession, callbacks annotated withListenerandSubscriptionand lifecycle methods annotated withPostConstruct.- Parameters:
bean- the annotated service instance- Returns:
- true if at least one dependency or callback 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
-
deprocess
Performs the opposite processing done byprocess(Object)on callbacks methods annotated withListenerandSubscription, 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:
process(Object)
-
deprocessCallbacks
Performs the opposite processing done byprocessCallbacks(Object)on callback methods annotated withListenerandSubscription.- 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
-