コード例 #1
0
        // log.warn("recognized several patterns in method:" + meth);
        protected virtual void buildPropMethodsDescriptors()
        {
            foreach (KeyValuePair<string, PropertyFact> entry in this.propertyFacts)
            {
                string propName = entry.Key;
                PropertyFact fact = entry.Value;
                PropMethodsDescriptor descr;
                switch (fact.getPropertyFieldType())
                {
                case MdaFieldCategory.FIELD_VALUE:
                    {
                        // descr = propMethodsDescriptors.get(propName);
                        // if (descr == null) PropMethodsDescriptor)
                        descr = new ValuePropMethodsDescriptor();
                        break;
                    }

                case MdaFieldCategory.FIELD_REF:
                    {
                        // TODO!! SHOULD NOT OCCUR!!!
                        log.warn("failed to determine if field '" + propName + "' is a Ref ById or by child aggregation => using AggrObjRef !");
                        descr = new AggrObjRefPropMethodsDescriptor();
                        break;
                    }

                case MdaFieldCategory.FIELD_REF_BY_ID:
                    {
                        descr = new RefByIdPropMethodsDescriptor();
                        break;
                    }

                case MdaFieldCategory.FIELD_AGGR_OBJECT_REF:
                    {
                        descr = new AggrObjRefPropMethodsDescriptor();
                        break;
                    }

                case MdaFieldCategory.FIELD_COLLECTION:
                case MdaFieldCategory.FIELD_LIST:
                    {
                        // TODO
                        descr = new ListPropMethodsDescriptor();
                        break;
                    }

                case MdaFieldCategory.FIELD_SET:
                    {
                        descr = new SetPropMethodsDescriptor();
                        break;
                    }

                case MdaFieldCategory.FIELD_MAP:
                    {
                        descr = new MapPropMethodsDescriptor();
                        break;
                    }

                case MdaFieldCategory.FIELD_ARRAY:
                    {
                        descr = new ArrayPropMethodsDescriptor();
                        break;
                    }

                default:
                    {
                        throw new System.InvalidOperationException();
                    }
                }
                // fill PropMethodsDescriptor from facts
                foreach (KeyValuePair<MethodRecognizer, System.Reflection.MethodInfo> recognizedEntry in fact.getRecognizedMethods())
                {
                    MethodRecognizer rec = recognizedEntry.Key;
                    System.Reflection.MethodInfo meth = recognizedEntry.Value;
                    try
                    {
                        rec.FillPropDescr(descr, fact, meth);
                    }
                    catch (System.Exception ex)
                    {
                        log.error("failed to set recognized method in PropertyDescriptor ... ignore", ex);
                    }
                }
                // ignore, no rethrow!
                propMethodsDescriptors[propName] = descr;
            }
        }
コード例 #2
0
        public MdaListFieldImpl(MdaClass ownerMdaClass, int internalFieldIndex,
			string fieldName, PropertiesNode tags, ListPropMethodsDescriptor methods)
            : base(ownerMdaClass, internalFieldIndex, fieldName, tags, methods)
        {
            this.methods = methods;
        }