예제 #1
0
        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);
        }
예제 #2
0
 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;
 }
예제 #3
0
        public IList<PropertyStem> AssessProperties(Type clazz)
        {
            var result = PropertyHelper.GetProperties(clazz);
            if (optionalLegacyConfig != null) {
                PropertyListBuilderExplicit.GetExplicitProperties(result, clazz, optionalLegacyConfig);
            }

            return result;
        }
예제 #4
0
 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);
     }
 }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
        }