/**
         * Constructs an instance with the incomplete annotation type and the name
         * of the element that's missing.
         *
         * @param annotationType
         *            the annotation type.
         * @param elementName
         *            the name of the incomplete element.
         */
        public IncompleteAnnotationException(
			java.lang.Class annotationType, String elementName)
            : base("The element, "+elementName+", is not complete for the annotation "+annotationType.getName()+".")
        {
            //$NON-NLS-1$
            this.annotationTypeJ = annotationType;
            this.elementNameJ = elementName;
        }
示例#2
0
        private static BeanInfo getExplicitBeanInfo(java.lang.Class beanClass)
        {
            String beanInfoClassName = beanClass.getName() + "BeanInfo"; //$NON-NLS-1$
            try
            {
                return loadBeanInfo(beanInfoClassName, beanClass);
            }
            catch (Exception e)
            {
                // 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 e)
                {
                    // 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 e)
                {
                    // fall through
                }
            }
            return null;
        }
示例#3
0
 /**
  * Inserts a provider at a specified position
  *
  * @param provider
  * @param position
  * @return
  */
 public static int insertProviderAt(java.security.Provider provider, int position)
 {
     int size = providers.size();
     if ((position < 1) || (position > size))
     {
         position = size + 1;
     }
     providers.add(position - 1, provider);
     providersNames.put(provider.getName(), provider);
     setNeedRefresh();
     return position;
 }
示例#4
0
 /**
  * <p>
  * Utility method for getting the unqualified name of a {@link Class}.
  * </p>
  *
  * @param leguminaClass
  *            The Class to get the name from.
  * @return A String instance or <code>null</code>.
  */
 private String getShortClassName(java.lang.Class leguminaClass)
 {
     if (leguminaClass == null)
     {
         return null;
     }
     String beanClassName = leguminaClass.getName();
     int lastIndex = beanClassName.lastIndexOf("."); //$NON-NLS-1$
     return (lastIndex == -1) ? beanClassName : beanClassName.substring(lastIndex + 1);
 }
示例#5
0
 /**
  * Constructs a new {@code InstantiationError} with the current stack trace
  * and the class that caused this error.
  *
  * @param clazz
  *            the class that can not be instantiated.
  */
 protected internal InstantiationError(java.lang.Class clazz)
     : base(clazz.getName())
 {
 }