Ejemplo n.º 1
0
        private static void AddPublicMethods(IList <InternalEventPropDescriptor> result, Type clazz)
        {
            var methods = clazz.GetMethods();

            for (int i = 0; i < methods.Length; i++)
            {
                if (methods[i].ReturnType == typeof(void))
                {
                    continue;
                }

                var parameters = methods[i].GetParameters();
                if (parameters.Length >= 2)
                {
                    continue;
                }
                if (parameters.Length == 1)
                {
                    Type parameterType = parameters[0].ParameterType;
                    if ((parameterType != typeof(int)) && ((parameterType != typeof(int?))) &&
                        (parameterType != typeof(String)))
                    {
                        continue;
                    }
                }

                InternalEventPropDescriptor desc = PropertyListBuilderExplicit.MakeMethodDesc(methods[i], methods[i].Name);
                result.Add(desc);
            }

            PropertyHelper.RemoveCLRProperties(result);
        }
Ejemplo n.º 2
0
 private static void AddPublicFields(ICollection <InternalEventPropDescriptor> result, Type clazz)
 {
     FieldInfo[] fields = clazz.GetFields();
     for (int i = 0; i < fields.Length; i++)
     {
         InternalEventPropDescriptor desc = PropertyListBuilderExplicit.MakeFieldDesc(fields[i], fields[i].Name);
         result.Add(desc);
     }
 }
Ejemplo n.º 3
0
        public IList <InternalEventPropDescriptor> AssessProperties(Type clazz)
        {
            var result = new List <InternalEventPropDescriptor>();

            PropertyListBuilderExplicit.GetExplicitProperties(result, clazz, _legacyConfig);
            AddPublicFields(result, clazz);
            AddPublicMethods(result, clazz);
            return(result);
        }
Ejemplo n.º 4
0
        public IList <InternalEventPropDescriptor> AssessProperties(Type type)
        {
            IList <InternalEventPropDescriptor> result = PropertyHelper.GetProperties(type);

            if (optionalLegacyConfig != null)
            {
                PropertyListBuilderExplicit.GetExplicitProperties(result, type, optionalLegacyConfig);
            }

            return(result);
        }
        private void TryInvalidField(String fieldName, Type clazz)
        {
            var config = new ConfigurationEventTypeLegacy();

            config.AddFieldProperty("name", fieldName);
            _builder = new PropertyListBuilderExplicit(config);

            try {
                _builder.AssessProperties(clazz);
            } catch (ConfigurationException ex) {
                // expected
                Log.Debug(ex.Message, ex);
            }
        }
        public void SetUp()
        {
            var config = new ConfigurationEventTypeLegacy();

            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);
        }