コード例 #1
0
 private void findAnnotation(System.Collections.Generic.ICollection <com.arangodb.entity.DocumentFieldAttribute.Type
                                                                     > values, System.Collections.Generic.IDictionary <com.arangodb.entity.DocumentFieldAttribute.Type
                                                                                                                       , java.lang.reflect.Field> fields, java.lang.reflect.Field field)
 {
     com.arangodb.entity.DocumentFieldAttribute annotation = field.getAnnotation <com.arangodb.entity.DocumentFieldAttribute
                                                                                  >();
     if (annotation != null && !field.isSynthetic() && !java.lang.reflect.Modifier.isStatic
             (field.getModifiers()) && typeof(string).isAssignableFrom
             (field.getType()))
     {
         com.arangodb.entity.DocumentFieldAttribute.Type value = annotation.value();
         if (values.contains(value))
         {
             field.setAccessible(true);
             fields[value] = field;
             values.remove(value);
         }
     }
 }
コード例 #2
0
        private void AddMembers(String p, Symbol s, java.lang.Class ci, List <object> exceptFor, int maxDepth)
        {
            Package pkg = CurrentPackage();
            String  ns  = ci.getName();

            if (!useClassname(ns))
            {
                return;
            }
            WriteLine("; importing " + p + " as " + ns);
            java.lang.reflect.Field[] fi = ci.getFields();
            for (int i = 0; i < fi.Length; i++)
            {
                java.lang.reflect.Field f = fi[i];
                f.setAccessible(true);
                String fname = ("" + p + "." + f.getName()).ToUpper();
                Symbol old   = pkg.findAccessibleSymbol(fname);
                if (old != null)
                {
                    //   fname = ("" + p + "%" + f.getName()).ToUpper() + "";
                    //  old = pkg.findAccessibleSymbol(fname);
                }
                bool needsClear = false;
                if (old == null)
                {
                    old        = pkg.intern(new SimpleString(fname));
                    needsClear = true;
                    // WriteLine(";;; skip field " + fname + " for " + f);
                    //  continue;
                }
                WriteLine(";;; field " + fname + " for " + f);
                Symbol sfm = Intern(fname, null, exceptFor, f.getType(), maxDepth - 1);// IkvmSite.fieldToInstanceSymbol(fname, pkg, s, f);
                if (needsClear)
                {
                    sfm.setSymbolValue(null);
                }

                if (maxDepth > 0)
                {
                    exceptFor.Add(f);
                    AddMembers(fname, sfm, f.getType(), exceptFor, maxDepth - 1);
                }
                else
                {
                    if (false && !exceptFor.Contains(f))
                    {
                        exceptFor.Add(f);
                        AddMembers(fname, sfm, ikvm.runtime.Util.getInstanceTypeFromClass(f.getType()), exceptFor, maxDepth - 1);
                    }
                }
            }
            java.lang.reflect.Method[] mi = ci.getDeclaredMethods();
            if (false)
            {
                for (int i = 0; i < mi.Length; i++)
                {
                    java.lang.reflect.Method m = mi[i];
                    String fname = ("" + p + "." + m.getName()).ToUpper() + "";
                    Symbol old   = pkg.findAccessibleSymbol(fname);
                    if (old != null)
                    {
                        fname = ("" + p + "/" + m.getName()).ToUpper() + "";
                        old   = pkg.findAccessibleSymbol(fname);
                    }
                    if (old != null)
                    {
                        fname = ("" + p + "//" + m.getName()).ToUpper() + "";
                        old   = pkg.findAccessibleSymbol(fname);
                    }
                    if (old != null)
                    {
                        WriteLine(";;; skip method " + fname + " for " + m);
                        continue;
                    }
                    WriteLine(";;; method " + p + " as " + fname + " to " + m);
                    //LispObject sfm = IkvmSite.methodToInstanceSymbol(fname, pkg, s, m);
                }
            }
        }