Ejemplo n.º 1
0
    internal static object AnnotationsToMap(ClassLoaderWrapper loader, object[] objAnn)
    {
#if FIRST_PASS
        return(null);
#else
        java.util.LinkedHashMap map = new java.util.LinkedHashMap();
        if (objAnn != null)
        {
            foreach (object obj in objAnn)
            {
                java.lang.annotation.Annotation a = obj as java.lang.annotation.Annotation;
                if (a != null)
                {
                    map.put(a.annotationType(), FreezeOrWrapAttribute(a));
                }
                else if (obj is IKVM.Attributes.DynamicAnnotationAttribute)
                {
                    a = (java.lang.annotation.Annotation)JVM.NewAnnotation(loader.GetJavaClassLoader(), ((IKVM.Attributes.DynamicAnnotationAttribute)obj).Definition);
                    if (a != null)
                    {
                        map.put(a.annotationType(), a);
                    }
                }
            }
        }
        return(map);
#endif
    }
Ejemplo n.º 2
0
        internal static object NewAnnotation(java.lang.ClassLoader classLoader, object definition)
        {
#if !FIRST_PASS
            java.lang.annotation.Annotation ann = null;
            try
            {
                ann = (java.lang.annotation.Annotation)[email protected](classLoader, definition);
            }
            catch (java.lang.TypeNotPresentException) { }
            if (ann != null && sun.reflect.annotation.AnnotationType.getInstance(ann.annotationType()).retention() == java.lang.annotation.RetentionPolicy.RUNTIME)
            {
                return(ann);
            }
#endif
            return(null);
        }