Methods Summary |
---|
void | checkInitialized(Logger pLogger)Makes sure that this class has been initialized, and synchronizes
the initialization if it's required.
if (!mInitialized) {
synchronized (this) {
if (!mInitialized) {
initialize (pLogger);
mInitialized = true;
}
}
}
|
static synchronized org.apache.taglibs.standard.lang.jstl.BeanInfoManager | createBeanInfoManager(java.lang.Class pClass)Creates and registers the BeanInfoManager for the given class if
it isn't already registered.
// Because this method is synchronized statically, the
// BeanInfoManager is not initialized at this time (otherwise it
// could end up being a bottleneck for the entire system). It is
// put into the map in an uninitialized state. The first time
// someone tries to use it, it will be initialized (with proper
// synchronizations in place to make sure it is only initialized
// once).
BeanInfoManager ret = (BeanInfoManager)
mBeanInfoManagerByClass.get (pClass);
if (ret == null) {
ret = new BeanInfoManager (pClass);
mBeanInfoManagerByClass.put (pClass, ret);
}
return ret;
|
public java.lang.Class | getBeanClass() return mBeanClass;
|
java.beans.BeanInfo | getBeanInfo(Logger pLogger)Returns the BeanInfo for the class
checkInitialized (pLogger);
return mBeanInfo;
|
public static BeanInfoIndexedProperty | getBeanInfoIndexedProperty(java.lang.Class pClass, java.lang.String pIndexedPropertyName, Logger pLogger)Returns the BeanInfoIndexedProperty for the specified property in
the given class, or null if not found.
return getBeanInfoManager
(pClass).getIndexedProperty (pIndexedPropertyName, pLogger);
|
public static org.apache.taglibs.standard.lang.jstl.BeanInfoManager | getBeanInfoManager(java.lang.Class pClass)Returns the BeanInfoManager for the specified class
BeanInfoManager ret = (BeanInfoManager)
mBeanInfoManagerByClass.get (pClass);
if (ret == null) {
ret = createBeanInfoManager (pClass);
}
return ret;
|
public static BeanInfoProperty | getBeanInfoProperty(java.lang.Class pClass, java.lang.String pPropertyName, Logger pLogger)Returns the BeanInfoProperty for the specified property in the
given class, or null if not found.
return getBeanInfoManager (pClass).getProperty (pPropertyName, pLogger);
|
public java.beans.EventSetDescriptor | getEventSet(java.lang.String pEventSetName, Logger pLogger)Returns the EventSetDescriptor for the given event set name, or
null if not found.
checkInitialized (pLogger);
return (EventSetDescriptor) mEventSetByName.get (pEventSetName);
|
public BeanInfoIndexedProperty | getIndexedProperty(java.lang.String pIndexedPropertyName, Logger pLogger)Returns the BeanInfoIndexedProperty for the given property name,
or null if not found.
checkInitialized (pLogger);
return (BeanInfoIndexedProperty)
mIndexedPropertyByName.get (pIndexedPropertyName);
|
public BeanInfoProperty | getProperty(java.lang.String pPropertyName, Logger pLogger)Returns the BeanInfoProperty for the given property name, or null
if not found.
checkInitialized (pLogger);
return (BeanInfoProperty) mPropertyByName.get (pPropertyName);
|
static java.lang.reflect.Method | getPublicMethod(java.lang.reflect.Method pMethod)Returns a publicly-accessible version of the given method, by
searching for a public declaring class.
if (pMethod == null) {
return null;
}
// See if the method is already available from a public class
Class cl = pMethod.getDeclaringClass ();
if (Modifier.isPublic (cl.getModifiers ())) {
return pMethod;
}
// Otherwise, try to find a public class that declares the method
Method ret = getPublicMethod (cl, pMethod);
if (ret != null) {
return ret;
}
else {
return pMethod;
}
|
static java.lang.reflect.Method | getPublicMethod(java.lang.Class pClass, java.lang.reflect.Method pMethod)If the given class is public and has a Method that declares the
same name and arguments as the given method, then that method is
returned. Otherwise the superclass and interfaces are searched
recursively.
// See if this is a public class declaring the method
if (Modifier.isPublic (pClass.getModifiers ())) {
try {
Method m;
try {
m = pClass.getDeclaredMethod (pMethod.getName (),
pMethod.getParameterTypes ());
} catch (java.security.AccessControlException ex) {
// kludge to accommodate J2EE RI's default settings
// TODO: see if we can simply replace
// getDeclaredMethod() with getMethod() ...?
m = pClass.getMethod(pMethod.getName (),
pMethod.getParameterTypes ());
}
if (Modifier.isPublic (m.getModifiers ())) {
return m;
}
}
catch (NoSuchMethodException exc) {}
}
// Search the interfaces
{
Class [] interfaces = pClass.getInterfaces ();
if (interfaces != null) {
for (int i = 0; i < interfaces.length; i++) {
Method m = getPublicMethod (interfaces [i], pMethod);
if (m != null) {
return m;
}
}
}
}
// Search the superclass
{
Class superclass = pClass.getSuperclass ();
if (superclass != null) {
Method m = getPublicMethod (superclass, pMethod);
if (m != null) {
return m;
}
}
}
return null;
|
void | initialize(Logger pLogger)Initializes by mapping property names to BeanInfoProperties
try {
mBeanInfo = Introspector.getBeanInfo (mBeanClass);
mPropertyByName = new HashMap ();
mIndexedPropertyByName = new HashMap ();
PropertyDescriptor [] pds = mBeanInfo.getPropertyDescriptors ();
for (int i = 0; pds != null && i < pds.length; i++) {
// Treat as both an indexed property and a normal property
PropertyDescriptor pd = pds [i];
if (pd instanceof IndexedPropertyDescriptor) {
IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
Method readMethod = getPublicMethod (ipd.getIndexedReadMethod ());
Method writeMethod = getPublicMethod (ipd.getIndexedWriteMethod ());
BeanInfoIndexedProperty property = new BeanInfoIndexedProperty
(readMethod,
writeMethod,
ipd);
mIndexedPropertyByName.put (ipd.getName (), property);
}
Method readMethod = getPublicMethod (pd.getReadMethod ());
Method writeMethod = getPublicMethod (pd.getWriteMethod ());
BeanInfoProperty property = new BeanInfoProperty
(readMethod,
writeMethod,
pd);
mPropertyByName.put (pd.getName (), property);
}
mEventSetByName = new HashMap ();
EventSetDescriptor [] esds = mBeanInfo.getEventSetDescriptors ();
for (int i = 0; esds != null && i < esds.length; i++) {
EventSetDescriptor esd = esds [i];
mEventSetByName.put (esd.getName (), esd);
}
}
catch (IntrospectionException exc) {
if (pLogger.isLoggingWarning ()) {
pLogger.logWarning
(Constants.EXCEPTION_GETTING_BEANINFO,
exc,
mBeanClass.getName ());
}
}
|