예제 #1
0
        private static BeanInfo getExplicitBeanInfo(java.lang.Class beanClass)
        {
            String beanInfoClassName = beanClass.getName() + "BeanInfo"; //$NON-NLS-1$

            try
            {
                return(loadBeanInfo(beanInfoClassName, beanClass));
            }
            catch (Exception)
            {
                // fall through
            }

            int    index        = beanInfoClassName.lastIndexOf('.');
            String beanInfoName = index >= 0 ? beanInfoClassName
                                  .substring(index + 1) : beanInfoClassName;
            BeanInfo       theBeanInfo    = null;
            BeanDescriptor beanDescriptor = null;

            for (int i = 0; i < searchPath.Length; i++)
            {
                beanInfoClassName = searchPath[i] + "." + beanInfoName; //$NON-NLS-1$
                try
                {
                    theBeanInfo = loadBeanInfo(beanInfoClassName, beanClass);
                }
                catch (Exception)
                {
                    // ignore, try next one
                    continue;
                }
                beanDescriptor = theBeanInfo.getBeanDescriptor();
                if (beanDescriptor != null &&
                    beanClass == beanDescriptor.getBeanClass())
                {
                    return(theBeanInfo);
                }
            }
            if (new java.lang.Class(typeof(BeanInfo)).isAssignableFrom(beanClass))
            {
                try
                {
                    return(loadBeanInfo(beanClass.getName(), beanClass));
                }
                catch (Exception)
                {
                    // fall through
                }
            }
            return(null);
        }
예제 #2
0
 public override BeanDescriptor getBeanDescriptor()
 {
     if (beanDescriptor == null)
     {
         if (explicitBeanInfo != null)
         {
             beanDescriptor = explicitBeanInfo.getBeanDescriptor();
         }
         if (beanDescriptor == null)
         {
             beanDescriptor = new BeanDescriptor(beanClass);
         }
     }
     return(beanDescriptor);
 }