com.googlecode.genericdao.dao
Class BaseDAODispatcher
java.lang.Object
com.googlecode.genericdao.dao.BaseDAODispatcher
- Direct Known Subclasses:
- DAODispatcher
public class BaseDAODispatcher
- extends Object
This class has some helpful properties and methods for use in making
DAODispatchers for various DAO implementations.
- Author:
- dwolverton
|
Method Summary |
protected Object |
callMethod(Object specificDAO,
String methodName,
Class<?>[] paramTypes,
Object... args)
|
protected Object |
callMethod(Object specificDAO,
String methodName,
Object... args)
|
protected Object |
getSpecificDAO(String className)
|
protected static Class<?> |
getTypeFromArray(Object[] array)
Get the type of an array's elements. |
protected static Class<?> |
getUniformArrayType(Object[] array)
If array is null, empty or has no non-null elements, return null
If array contains all elements of the same type, return that type
If array contains several different element types, return
Object.class
|
void |
setSpecificDAOs(Map<String,Object> specificDAOs)
In practice some DAOs could be put into this map using Spring. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
specificDAOs
protected Map<String,Object> specificDAOs
BaseDAODispatcher
public BaseDAODispatcher()
setSpecificDAOs
public void setSpecificDAOs(Map<String,Object> specificDAOs)
- In practice some DAOs could be put into this map using Spring. If a DAO
is in this map, it will be used instead of the general DAO. This provides
a way to override the default implementation for objects with special
considerations.
getSpecificDAO
protected Object getSpecificDAO(String className)
callMethod
protected Object callMethod(Object specificDAO,
String methodName,
Object... args)
callMethod
protected Object callMethod(Object specificDAO,
String methodName,
Class<?>[] paramTypes,
Object... args)
getTypeFromArray
protected static Class<?> getTypeFromArray(Object[] array)
- Get the type of an array's elements. If the type of the array is more
specific than "Object", the array type will be returned. Otherwise the
most general of the types of the elements will be returned.
getUniformArrayType
protected static Class<?> getUniformArrayType(Object[] array)
- If array is null, empty or has no non-null elements, return null
- If array contains all elements of the same type, return that type
- If array contains several different element types, return
Object.class
Copyright © 2008-2011. All Rights Reserved.