net.sf.fikin.pojostate.select
Class AbstractSelector

java.lang.Object
  extended by net.sf.fikin.pojostate.select.AbstractSelector
All Implemented Interfaces:
Selector
Direct Known Subclasses:
BeanMethodsSelector, ResourceBundleSelector

public abstract class AbstractSelector
extends java.lang.Object
implements Selector

Abstract implementation of Selector interface.

It provides with default implementation for getMethodMeta(Class, Method, Locale, ClassLoader) based on defined by subclasses two factory methods. created on Mar 1, 2007

Since:
Version:
$Revision: 1.1 $
Author:
fiykov

Constructor Summary
AbstractSelector()
           
 
Method Summary
 MethodMeta getMethodMeta(java.lang.Class clazz, java.lang.reflect.Method method, java.util.Locale locale, java.lang.ClassLoader loader)
          test if the method is applicable by calling isApplicable(Class, Method, Locale, ClassLoader) and creates new property via newMethodMeta(Class, Method, Locale, ClassLoader) if yes.
protected abstract  boolean isApplicable(java.lang.Class clazz, java.lang.reflect.Method method, java.util.Locale locale, java.lang.ClassLoader loader)
          test if given method is to be observed
protected abstract  MethodMeta newMethodMeta(java.lang.Class clazz, java.lang.reflect.Method method, java.util.Locale locale, java.lang.ClassLoader loader)
          instantiate new method metadata object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSelector

public AbstractSelector()
Method Detail

getMethodMeta

public MethodMeta getMethodMeta(java.lang.Class clazz,
                                java.lang.reflect.Method method,
                                java.util.Locale locale,
                                java.lang.ClassLoader loader)
                         throws DecorationException
test if the method is applicable by calling isApplicable(Class, Method, Locale, ClassLoader) and creates new property via newMethodMeta(Class, Method, Locale, ClassLoader) if yes.

returns null if not applicable

Specified by:
getMethodMeta in interface Selector
Parameters:
clazz - is POJO's class
method - which is to be to be examined
locale - to be used when creating the metadata
loader - is the classloader to be used to load any resource file (if required)
Returns:
a valid MethodMeta if this method a suitable for inclusion in State and null if it is not
Throws:
DecorationException - in case of internal error

isApplicable

protected abstract boolean isApplicable(java.lang.Class clazz,
                                        java.lang.reflect.Method method,
                                        java.util.Locale locale,
                                        java.lang.ClassLoader loader)
                                 throws DecorationException
test if given method is to be observed

Parameters:
clazz - is POJO's class
method - which is to be to be examined
locale - to be used when creating the metadata
loader - is the classloader to be used to load any resource file (if required)
Returns:
true if this is a suitable for State method, otherwise false.
Throws:
DecorationException

newMethodMeta

protected abstract MethodMeta newMethodMeta(java.lang.Class clazz,
                                            java.lang.reflect.Method method,
                                            java.util.Locale locale,
                                            java.lang.ClassLoader loader)
                                     throws DecorationException
instantiate new method metadata object

Parameters:
clazz - is POJO's class
method - which is to be to be examined
locale - to be used when creating the metadata
loader - is the classloader to be used to load any resource file (if required)
Returns:
new and initialized MethodMeta object
Throws:
DecorationException - in case of internal error


Copyright © 2005 Nikolay Fiykov. All Rights Reserved.