private static void AddPublicMethods( IList<PropertyStem> result, Type clazz) { var methods = clazz.GetMethods(); for (var i = 0; i < methods.Length; i++) { if (methods[i].ReturnType == typeof(void)) { continue; } var parameterTypes = methods[i].GetParameterTypes(); if (parameterTypes.Length >= 2) { continue; } if (parameterTypes.Length == 1) { var parameterType = parameterTypes[0]; if (parameterType != typeof(int) && parameterType != typeof(int?) && parameterType != typeof(string)) { continue; } } var desc = PropertyListBuilderExplicit.MakeMethodDesc(methods[i], methods[i].Name); result.Add(desc); } PropertyHelper.RemovePlatformProperties(result); }
public IList<PropertyStem> AssessProperties(Type clazz) { IList<PropertyStem> result = new List<PropertyStem>(); PropertyListBuilderExplicit.GetExplicitProperties(result, clazz, legacyConfig); AddPublicFields(result, clazz); AddPublicMethods(result, clazz); return result; }
public IList<PropertyStem> AssessProperties(Type clazz) { var result = PropertyHelper.GetProperties(clazz); if (optionalLegacyConfig != null) { PropertyListBuilderExplicit.GetExplicitProperties(result, clazz, optionalLegacyConfig); } return result; }
private static void AddPublicFields( IList<PropertyStem> result, Type clazz) { var fields = clazz.GetFields(); for (var i = 0; i < fields.Length; i++) { var desc = PropertyListBuilderExplicit.MakeFieldDesc(fields[i], fields[i].Name); result.Add(desc); } }
private void TryInvalidField(string fieldName, Type clazz) { ConfigurationCommonEventTypeBean config = new ConfigurationCommonEventTypeBean(); config.AddFieldProperty("name", fieldName); builder = new PropertyListBuilderExplicit(config); try { builder.AssessProperties(clazz); } catch (ConfigurationException ex) { // expected log.Debug(ex.Message); } }
public void SetUp() { ConfigurationCommonEventTypeBean config = new ConfigurationCommonEventTypeBean(); config.AddFieldProperty("f_legVal", "fieldLegacyVal"); config.AddFieldProperty("f_strArr", "fieldStringArray"); config.AddFieldProperty("f_strMap", "fieldMapped"); config.AddFieldProperty("f_legNested", "fieldNested"); config.AddMethodProperty("m_legVal", "ReadLegacyBeanVal"); config.AddMethodProperty("m_strArr", "ReadStringArray"); config.AddMethodProperty("m_strInd", "ReadStringIndexed"); config.AddMethodProperty("m_strMapKeyed", "ReadMapByKey"); config.AddMethodProperty("m_strMap", "ReadMap"); config.AddMethodProperty("m_legNested", "ReadLegacyNested"); builder = new PropertyListBuilderExplicit(config); }