// Method Recognizer for Map // ------------------------------------------------------------------------ public override sealed void FillPropDescr(PropMethodsDescriptor descr, PropertyFact fact, System.Reflection.MethodInfo meth) { if (descr is MapPropMethodsDescriptor) { MapPropMethodsDescriptor d = (MapPropMethodsDescriptor) descr; doFillPropDescr(d, fact, meth); } }
public override PropertyFact RunRecognizer(System.Reflection.MethodInfo m) { PropertyFact res; string methName = m.Name; System.Type retType = m.ReturnType; System.Reflection.ParameterInfo[] parameters = m.GetParameters(); if (retType==typeof(void) && IsNameStartsWith(methName, "Set", "set") && parameters.Length == 1) { string name; if (methName.StartsWith("set_")) name = nameToBaseName(methName, "set_", null); else if (methName.StartsWith("set")) name = nameToBaseName(methName, "set", null); else if (methName.StartsWith("Set_")) name = nameToBaseName(methName, "Set_", null); else if (methName.StartsWith("Set")) name = nameToBaseName(methName, "Set", null); else name = methName; // should not occur System.Type propType = parameters[0].ParameterType; MdaFieldCategory cat = defaultTypeToFieldType(propType); res = new PropertyFact(name, propType, cat); res.putRecognizedMethod(this, m); } else { res = null; } return res; }
public override void FillPropDescr(PropMethodsDescriptor descr , PropertyFact fact, System.Reflection.MethodInfo meth ) { descr.setMethod = meth; }
public override PropertyFact RunRecognizer(System.Reflection.MethodInfo m) { PropertyFact res; string methName = m.Name; System.Type retType = m.ReturnType; System.Reflection.ParameterInfo[] parameters = m.GetParameters(); if (IsNameStartsWith(methName, "Remove", "remove") && parameters.Length == 1) { string name; if (methName.StartsWith("Remove")) name = nameToBaseName(methName, "Remove", null); else if (methName.StartsWith("remove")) name = nameToBaseName(methName, "remove", null); else name = methName; // should not occur System.Type propType = typeof(System.Collections.IDictionary); MdaMvc4Net.Reflect.MdaFieldCategory cat = defaultTypeToFieldType(propType); res = new PropertyFact(name, retType, cat); res.setMapKeyElementType(parameters[0].ParameterType); res.putRecognizedMethod(this, m); } else { res = null; } return res; }
// ------------------------------------------------------------------------ public override PropertyFact RunRecognizer(System.Reflection.MethodInfo m) { PropertyFact res; string methName = m.Name; System.Type retType = m.ReturnType; System.Reflection.ParameterInfo[] parameterInfos = m.GetParameters(); if (retType!=typeof(void) && (IsNameStartsWith(methName, "Get", "get") || (IsNameStartsWith(methName, "Is", "is") && retType==typeof(bool))) && parameterInfos.Length == 0) { string name; if (methName.StartsWith("get_")) name = nameToBaseName(methName, "get_", null); else if (methName.StartsWith("get")) name = nameToBaseName(methName, "get", null); else if (methName.StartsWith("Get_")) name = nameToBaseName(methName, "Get_", null); else if (methName.StartsWith("Get")) name = nameToBaseName(methName, "Get", null); else if (methName.StartsWith("Is")) name = nameToBaseName(methName, "Is", null); else if (methName.StartsWith("is")) name = nameToBaseName(methName, "is", null); else name = methName; // should not occur MdaFieldCategory cat = defaultTypeToFieldType(retType); res = new PropertyFact(name, retType, cat); res.putRecognizedMethod(this, m); } else { res = null; } return res; }
public override void FillPropDescr(MdaMvc4Net.Reflect.Impl.PropMethodsDescriptor descr, PropertyFact fact, System.Reflection.MethodInfo meth) { descr.getMethod = meth; }
public abstract void doFillPropDescr(MapPropMethodsDescriptor descr, PropertyFact fact, System.Reflection.MethodInfo meth);
public override PropertyFact RunRecognizer(System.Reflection.MethodInfo m) { PropertyFact res; string methName = m.Name; System.Type retType = m.ReturnType; System.Reflection.ParameterInfo[] parameters = m.GetParameters(); if ( (retType==typeof(bool) || retType==typeof(void)) && IsNameStartsWith(methName, "Remove", "remove") && parameters.Length == 1) { string name; if (methName.StartsWith("remove_")) name = nameToBaseName(methName, "remove_", null); else if (methName.StartsWith("remove")) name = nameToBaseName(methName, "remove", null); else if (methName.StartsWith("Remove_")) name = nameToBaseName(methName, "Remove_", null); else if (methName.StartsWith("Remove")) name = nameToBaseName(methName, "Remove", null); else name = methName; // should not occur System.Type propType = typeof(System.Collections.ICollection); //??? TODO ambiguous!! MdaFieldCategory cat = defaultTypeToFieldType(propType); res = new PropertyFact(name, retType, cat); System.Type elemType = parameters[0].ParameterType; res.setCollectionElementType(elemType); res.putRecognizedMethod(this, m); } else { res = null; } return res; }
public override void doFillPropDescr(CollectionPropMethodsDescriptor descr, PropertyFact fact, System.Reflection.MethodInfo meth) { descr.RemoveMethod = meth; }
public override PropertyFact RunRecognizer(System.Reflection.MethodInfo m) { PropertyFact res; string methName = m.Name; System.Type retType = m.ReturnType; System.Reflection.ParameterInfo[] parameters = m.GetParameters(); if (retType==typeof(void) && IsNameStartsWith(methName, "RemoveAll", "removeAll") && parameters.Length == 1 && parameters[0].ParameterType.IsAssignableFrom(typeof(System.Collections.ICollection))) { string name; if (methName.StartsWith("RemoveAll")) name = nameToBaseName(methName, "RemoveAll", null); else if (methName.StartsWith("removeAll")) name = nameToBaseName(methName, "removeAll", null); else if (methName.StartsWith("RemoveRange")) name = nameToBaseName(methName, "RemoveRange", null); else name = methName; // should not occur System.Type propType = parameters[0].ParameterType; MdaMvc4Net.Reflect.MdaFieldCategory cat = defaultTypeToFieldType(propType); res = new PropertyFact(name, propType, cat); // TODO test if argument use generic type // Class<?> elemType // res.setPropertyElementType(elemType); res.putRecognizedMethod(this, m); } else { res = null; } return res; }