org.iqual.chaplin
Class AbstractContextHandler

java.lang.Object
  extended by org.iqual.chaplin.AbstractContextHandler
All Implemented Interfaces:
ContextHandler, MessageReceiver
Direct Known Subclasses:
MapContextHandler

public abstract class AbstractContextHandler
extends Object
implements ContextHandler

This abstract class makes a context handler implementation easier by translating from the raw language of messages to more concrete language containing concepts like property and methods.

Since:
Jun 12, 2009 7:28:32 PM
Author:
Zbynek Slajchrt

Constructor Summary
AbstractContextHandler()
           
 
Method Summary
protected abstract  boolean canInvoke(Object source, String methodName, Class[] methodDesc)
          Request for possibility of method invocation.
protected abstract  Object get(String propertyName, Class fieldType, Object instance)
          Request for value of a property.
protected abstract  boolean hasValue(String propertyName, Class fieldType)
          Request for existence of a property.
protected abstract  boolean invoke(Object source, String methodName, Class[] methodDesc)
          Request for the method invocation.
 void onMessageReceived(Message message, MessageReplies replies, MessageReceiversChain chain)
          Called when a request is made.
protected abstract  void set(String propertyName, Class fieldType, Object value, Object instance)
          Request for setting the value of a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractContextHandler

public AbstractContextHandler()
Method Detail

onMessageReceived

public void onMessageReceived(Message message,
                              MessageReplies replies,
                              MessageReceiversChain chain)
                       throws Throwable
Description copied from interface: MessageReceiver
Called when a request is made. The receiver must call the chain's process method so that the subsequent receivers could be called. The receiver may manipulate with the arguments passed to that method. For example it may change the message that will be processed by the subsequent receivers in the chain or change the results of the subsequent message processing.

Specified by:
onMessageReceived in interface MessageReceiver
Throws:
Throwable

hasValue

protected abstract boolean hasValue(String propertyName,
                                    Class fieldType)
                             throws Exception
Request for existence of a property.

Throws:
Exception

get

protected abstract Object get(String propertyName,
                              Class fieldType,
                              Object instance)
                       throws Exception
Request for value of a property.

Throws:
Exception

set

protected abstract void set(String propertyName,
                            Class fieldType,
                            Object value,
                            Object instance)
                     throws Exception
Request for setting the value of a property.

Throws:
Exception

canInvoke

protected abstract boolean canInvoke(Object source,
                                     String methodName,
                                     Class[] methodDesc)
                              throws Exception
Request for possibility of method invocation.

Throws:
Exception

invoke

protected abstract boolean invoke(Object source,
                                  String methodName,
                                  Class[] methodDesc)
                           throws Exception
Request for the method invocation.

Throws:
Exception


Copyright © 2009 iquality.org. All Rights Reserved.