Ejemplo n.º 1
0
 /// <exception cref="ArangoDBException"/>
 public virtual void setValues(object doc, System.Collections.Generic.IDictionary <
                                   com.arangodb.entity.DocumentFieldAttribute.Type, string> values)
 {
     try
     {
         System.Collections.Generic.IDictionary <com.arangodb.entity.DocumentFieldAttribute.Type, java.lang.reflect.Field
                                                 > fields = this.getFields(Sharpen.Runtime.getClassForObject(doc));
         foreach (System.Collections.Generic.KeyValuePair <com.arangodb.entity.DocumentFieldAttribute.Type
                                                           , string> value in values)
         {
             java.lang.reflect.Field field = fields[value.Key];
             if (field != null)
             {
                 field.set(doc, value.Value);
             }
         }
     }
     catch (System.ArgumentException e)
     {
         throw new ArangoDBException(e);
     }
     catch (java.lang.IllegalAccessException e)
     {
         throw new ArangoDBException(e);
     }
 }
Ejemplo n.º 2
0
        public virtual global::System.Object getFields()
        {
//XMLVM_BEGIN_WRAPPER[java.lang.Class: java.lang.reflect.Field[] getFields()]
            org.xmlvm._nTIB     tib        = (org.xmlvm._nTIB) this._ftib;
            global::System.Type nativeType = tib.getNativeType();
            global::System.Reflection.BindingFlags bindingFlags
                = global::System.Reflection.BindingFlags.Static
                  | global::System.Reflection.BindingFlags.Instance
                  | global::System.Reflection.BindingFlags.Public
                  | global::System.Reflection.BindingFlags.NonPublic;
            global::System.Reflection.FieldInfo[] fieldInfos
                = nativeType.GetFields(bindingFlags);
            java.lang.reflect.Field[] jFields = new java.lang.reflect.Field[fieldInfos.Length];
            for (int i = 0; i < fieldInfos.Length; i++)
            {
                global::System.Reflection.FieldInfo fieldInfo = fieldInfos[i];
                java.lang.reflect.Field             jField
                    = org.xmlvm._nMemberInfoAdapter <global::System.Reflection.FieldInfo,
                                                     java.lang.reflect.Field._nImpl> .getJavaClient(fieldInfo);

                jFields[i] = jField;
            }
            return(new org.xmlvm._nArrayAdapter <object>(jFields));

            throw new org.xmlvm._nNotYetImplementedException("native/wrapper method not yet implemented");
//XMLVM_END_WRAPPER[java.lang.Class: java.lang.reflect.Field[] getFields()]
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
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());
 }
Ejemplo n.º 5
0
        public static object DynamicGetstatic(string name, string sig, RuntimeTypeHandle type, string clazz, [email protected] callerID)
        {
            Profiler.Count("DynamicGetstatic");
            FieldWrapper fw = GetFieldWrapper(null, type, clazz, name, sig, true);

            java.lang.reflect.Field field = (java.lang.reflect.Field)fw.ToField(false);
            object val = field.get(null, callerID);

            if (fw.FieldTypeWrapper.IsPrimitive)
            {
                val = JVM.Unbox(val);
            }
            return(val);
        }
Ejemplo n.º 6
0
        public static object DynamicGetfield(object obj, string name, string sig, RuntimeTypeHandle type, string clazz, [email protected] callerID)
        {
            Profiler.Count("DynamicGetfield");
            FieldWrapper fw = GetFieldWrapper(ClassLoaderWrapper.GetWrapperFromType(obj.GetType()), type, clazz, name, sig, false);

            java.lang.reflect.Field field = (java.lang.reflect.Field)fw.ToField(false);
            object val = field.get(obj, callerID);

            if (fw.FieldTypeWrapper.IsPrimitive)
            {
                val = JVM.Unbox(val);
            }
            return(val);
        }
Ejemplo n.º 7
0
        private bool Method2(int arg)
        {
            if (arg == 0)
            {
                int count = 10;
            }
            FileInputStream stream         = new FileInputStream("Test");
            int             count_Renamed1 = Float.floatToIntBits(10f);

            byte[] buffer = new byte[count_Renamed1];
            stream.read(buffer);
            java.lang.reflect.Field f = null;
            return(Modifier.isTransient(f.getModifiers()));
        }
Ejemplo n.º 8
0
        public static void DynamicPutstatic(object val, string name, string sig, RuntimeTypeHandle type, string clazz, [email protected] callerID)
        {
            Profiler.Count("DynamicPutstatic");
            FieldWrapper fw = GetFieldWrapper(null, type, clazz, name, sig, true);

            if (fw.IsFinal)
            {
                throw new java.lang.IllegalAccessError("Field " + fw.DeclaringType.Name + "." + fw.Name + " is final");
            }
            java.lang.reflect.Field field = (java.lang.reflect.Field)fw.ToField(false);
            if (fw.FieldTypeWrapper.IsPrimitive)
            {
                val = JVM.Box(val);
            }
            field.set(null, val, callerID);
        }
Ejemplo n.º 9
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);
         }
     }
 }
Ejemplo n.º 10
0
		internal object ToField(bool copy)
		{
#if FIRST_PASS
			return null;
#else
			java.lang.reflect.Field field = reflectionField;
			if (field == null)
			{
				Link();
				field = new java.lang.reflect.Field(
					this.DeclaringType.ClassObject,
					this.Name,
					this.FieldTypeWrapper.EnsureLoadable(this.DeclaringType.GetClassLoader()).ClassObject,
					(int)this.Modifiers | (this.IsInternal ? 0x40000000 : 0),
					Array.IndexOf(this.DeclaringType.GetFields(), this),
					this.DeclaringType.GetGenericFieldSignature(this),
					null
				);
			}
			lock (this)
			{
				if (reflectionField == null)
				{
					reflectionField = field;
				}
				else
				{
					field = reflectionField;
				}
			}
			if (copy)
			{
				field = field.copy();
			}
			return field;
#endif // FIRST_PASS
		}
Ejemplo n.º 11
0
        //
        // constructor
        //

        private RuntimeFieldInfo(java.lang.reflect.Field javaField,
                                 system.RuntimeType reflectedType)
        {
            this.JavaField     = javaField;
            this.reflectedType = reflectedType;
        }
		internal object ToField(bool copy, int? fieldIndex)
		{
#if FIRST_PASS
			return null;
#else
			java.lang.reflect.Field field = reflectionField;
			if (field == null)
			{
				const Modifiers ReflectionFieldModifiersMask = Modifiers.Public | Modifiers.Private | Modifiers.Protected | Modifiers.Static
					| Modifiers.Final | Modifiers.Volatile | Modifiers.Transient | Modifiers.Synthetic | Modifiers.Enum;
				Link();
				field = new java.lang.reflect.Field(
					this.DeclaringType.ClassObject,
					this.Name,
					this.FieldTypeWrapper.EnsureLoadable(this.DeclaringType.GetClassLoader()).ClassObject,
					(int)(this.Modifiers & ReflectionFieldModifiersMask) | (this.IsInternal ? 0x40000000 : 0),
					fieldIndex ?? Array.IndexOf(this.DeclaringType.GetFields(), this),
					this.DeclaringType.GetGenericFieldSignature(this),
					null
				);
			}
			lock (this)
			{
				if (reflectionField == null)
				{
					reflectionField = field;
				}
				else
				{
					field = reflectionField;
				}
			}
			if (copy)
			{
				field = field.copy();
			}
			return field;
#endif // FIRST_PASS
		}
Ejemplo n.º 13
0
public virtual global::System.Object getFields(){
//XMLVM_BEGIN_WRAPPER[java.lang.Class: java.lang.reflect.Field[] getFields()]
    org.xmlvm._nTIB tib = (org.xmlvm._nTIB) this._ftib;
    global::System.Type nativeType = tib.getNativeType();
    //global::System.Reflection.BindingFlags bindingFlags
    //    = global::System.Reflection.BindingFlags.Static
    //      | global::System.Reflection.BindingFlags.Instance
    //      | global::System.Reflection.BindingFlags.Public
    //      | global::System.Reflection.BindingFlags.NonPublic;
    global::System.Collections.Generic.IEnumerable<FieldInfo> fieldInfosArray = nativeType.GetTypeInfo().DeclaredFields;
    //global::System.Reflection.FieldInfo[] fieldInfos 
    //    = nativeType.GetFields(bindingFlags);
    int i = 0;
    foreach (FieldInfo fieldInfo in fieldInfosArray)
    {
        i++;
    } 
    java.lang.reflect.Field[] jFields = new java.lang.reflect.Field[i];
    i = 0;
    foreach (FieldInfo fieldInfo in fieldInfosArray)
    {
        java.lang.reflect.Field jField 
            = org.xmlvm._nMemberInfoAdapter<global::System.Reflection.FieldInfo,
                                            java.lang.reflect.Field._nImpl>.getJavaClient(fieldInfo);
        jFields[i] = jField;
        i++;
    }
    return new org.xmlvm._nArrayAdapter<object>(jFields);

    throw new org.xmlvm._nNotYetImplementedException("native/wrapper method not yet implemented:: getFields()");
//XMLVM_END_WRAPPER[java.lang.Class: java.lang.reflect.Field[] getFields()]
}
Ejemplo n.º 14
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);
                }
            }
        }
Ejemplo n.º 15
0
 public _FieldInfo_153(java.lang.reflect.Field field, global::System.Type baseArg1
                       , string baseArg2, bool baseArg3, bool baseArg4)
     : base(baseArg1, baseArg2, baseArg3, baseArg4)
 {
     this.field = field;
 }
Ejemplo n.º 16
0
 public RuntimeFieldHandle(javaField field)
 {
     this.field = field;
 }