org.jboss.seam.exception.control
Class HandlerMethodImpl<T extends Throwable>

java.lang.Object
  extended by org.jboss.seam.exception.control.HandlerMethodImpl<T>
Type Parameters:
T - Type of the exception this handler handles.
All Implemented Interfaces:
HandlerMethod<T>

public class HandlerMethodImpl<T extends Throwable>
extends Object
implements HandlerMethod<T>

Implementation of HandlerMethod.


Constructor Summary
HandlerMethodImpl(AnnotatedMethod<?> method, BeanManager bm)
          Sole Constructor.
 
Method Summary
 boolean equals(Object o)
           
static AnnotatedParameter<?> findHandlerParameter(AnnotatedMethod<?> method)
           
 Bean<?> getBean(BeanManager bm)
          Obtains the Bean reference that declares the observer method.
 Class<?> getBeanClass()
          Obtains the bean class of the bean that declares the observer method.
 Type getExceptionType()
          Obtains the handled event type.
 AnnotatedParameter<?> getHandlerParameter()
          Obtains the actual parameter defining this as a handler.
 Method getJavaMethod()
          Obtains the actual method of the handler.
 int getPrecedence()
          Obtains the precedence of the handler.
 Set<Annotation> getQualifiers()
          Obtains the set of handled event qualifiers.
 TraversalMode getTraversalMode()
          Obtains the direction of the traversal path the handler will be listening.
 int hashCode()
           
static boolean isHandler(AnnotatedMethod<?> method)
          Determines if the given method is a handler by looking for the Handles annotation on a parameter.
 void notify(CaughtException<T> event, BeanManager bm)
          Calls the handler method, passing the given event object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HandlerMethodImpl

public HandlerMethodImpl(AnnotatedMethod<?> method,
                         BeanManager bm)
Sole Constructor.

Parameters:
method - found handler
bm - active BeanManager
Throws:
IllegalArgumentException - if method is null, has no params or first param is not annotated with Handles
Method Detail

isHandler

public static boolean isHandler(AnnotatedMethod<?> method)
Determines if the given method is a handler by looking for the Handles annotation on a parameter.

Parameters:
method - method to search
Returns:
true if Handles is found, false otherwise

findHandlerParameter

public static AnnotatedParameter<?> findHandlerParameter(AnnotatedMethod<?> method)

getBeanClass

public Class<?> getBeanClass()
Obtains the bean class of the bean that declares the observer method.

Specified by:
getBeanClass in interface HandlerMethod<T extends Throwable>

getBean

public Bean<?> getBean(BeanManager bm)
Obtains the Bean reference that declares the observer method.

Specified by:
getBean in interface HandlerMethod<T extends Throwable>
Parameters:
bm - Active BeanManager

getQualifiers

public Set<Annotation> getQualifiers()
Obtains the set of handled event qualifiers.

Specified by:
getQualifiers in interface HandlerMethod<T extends Throwable>

getExceptionType

public Type getExceptionType()
Obtains the handled event type.

Specified by:
getExceptionType in interface HandlerMethod<T extends Throwable>

notify

public void notify(CaughtException<T> event,
                   BeanManager bm)
Calls the handler method, passing the given event object.

Specified by:
notify in interface HandlerMethod<T extends Throwable>
Parameters:
event - event to pass to the handler.
bm - Active BeanManager

getTraversalMode

public TraversalMode getTraversalMode()
Obtains the direction of the traversal path the handler will be listening.

Specified by:
getTraversalMode in interface HandlerMethod<T extends Throwable>

getPrecedence

public int getPrecedence()
Obtains the precedence of the handler.

Specified by:
getPrecedence in interface HandlerMethod<T extends Throwable>

getJavaMethod

public Method getJavaMethod()
Obtains the actual method of the handler.

Specified by:
getJavaMethod in interface HandlerMethod<T extends Throwable>

getHandlerParameter

public AnnotatedParameter<?> getHandlerParameter()
Description copied from interface: HandlerMethod
Obtains the actual parameter defining this as a handler.

Specified by:
getHandlerParameter in interface HandlerMethod<T extends Throwable>

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Seam Framework. All Rights Reserved.