Exemplo n.º 1
0
        private VPackCache.FieldInfo createFieldInfo(java.lang.reflect.Field
                                                     field)
        {
            string fieldName = field.getName();

            if (this.fieldNamingStrategy != null)
            {
                fieldName = this.fieldNamingStrategy.translateName(field);
            }
            com.arangodb.velocypack.annotations.SerializedName annotationName = field.getAnnotation
                                                                                <com.arangodb.velocypack.annotations.SerializedName>();
            if (annotationName != null)
            {
                fieldName = annotationName.value();
            }
            com.arangodb.velocypack.annotations.Expose expose = field.getAnnotation <com.arangodb.velocypack.annotations.Expose
                                                                                     >();
            bool serialize = expose != null?expose.serialize() : true;

            bool deserialize = expose != null?expose.deserialize() : true;

            java.lang.Class     clazz = field.getType();
            global::System.Type type;
            if (typeof(System.Collections.ICollection).isAssignableFrom
                    (clazz) || typeof(System.Collections.IDictionary
                                      ).isAssignableFrom(clazz))
            {
                type = (java.lang.reflect.ParameterizedType)field.getGenericType();
            }
            else
            {
                type = clazz;
            }
            return(new _FieldInfo_153(field, type, fieldName, serialize, deserialize));
        }
Exemplo n.º 2
0
 public string translateName(java.lang.reflect.Field field)
 {
     com.arangodb.entity.DocumentFieldAttribute annotation = field.getAnnotation <com.arangodb.entity.DocumentFieldAttribute
                                                                                  >();
     if (annotation != null)
     {
         return(annotation.value().getSerializeName());
     }
     return(field.getName());
 }
Exemplo n.º 3
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);
                }
            }
        }