private object GetField(object obj, string fieldName) { IReflectClass clazz = Reflector().ForObject(obj); IReflectField field = clazz.GetDeclaredField(fieldName); return(field.Get(obj)); }
public void SetField(object onObject, string fieldName, object value) { IReflectField field = _type.GetDeclaredField(fieldName); if (field == null) { throw new ArgumentException("No field '" + fieldName + "' found in '" + FullName + "'"); } field.Set(onObject, value); }
public static IReflectField GetDeclaredField(IReflectClass aClass, string attribute) { try { return(aClass.GetDeclaredField(attribute)); } catch (Exception e) { LoggingHelper.HandleException(e); } return(null); }
public static IReflectField GetDeclaredField(IReflectClass aClass, string attribute) { try { return aClass.GetDeclaredField(attribute); } catch (Exception e) { LoggingHelper.HandleException(e); } return null; }
public static IReflectField Field(IReflectClass claxx, string name) { while (claxx != null) { try { return(claxx.GetDeclaredField(name)); } catch (Exception) { } claxx = claxx.GetSuperclass(); } return(null); }
// TODO: consider that classes may have two fields of // the same name after refactoring. public virtual IReflectField GetDeclaredField(string name) { if (_delegate != null) { return(_delegate.GetDeclaredField(name)); } for (int i = 0; i < _fields.Length; i++) { if (_fields[i].GetName().Equals(name)) { return(_fields[i]); } } return(null); }
public static IReflectField Field(IReflectClass claxx, string name) { while (claxx != null) { try { return claxx.GetDeclaredField(name); } catch (Exception) { } claxx = claxx.GetSuperclass(); } return null; }
private ClassMetadata DetectFieldType() { IReflectClass claxx = _containingClass.ClassReflector(); if (claxx == null) { return(null); } _reflectField = claxx.GetDeclaredField(_name); if (_reflectField == null) { return(null); } IReflectClass fieldType = _reflectField.GetFieldType(); if (fieldType == null) { return(null); } return(Handlers4.ErasedFieldType(Container(), fieldType)); }
private static IReflectField Field(IReflectClass klass, string fieldName) { return(klass.GetDeclaredField(fieldName)); }