missing java doc comments or could not find the source file.
Inheritance: Simpl.Serialization.FieldDescriptor
コード例 #1
0
        public MetadataFieldDescriptor Clone()
        {
            MetadataFieldDescriptor result = this.MemberwiseClone() as MetadataFieldDescriptor;

            result.clonedFrom = this;
            return(result);
        }
コード例 #2
0
        public int NumberOfVisibleFields(bool considerAlwaysShow = true)
        {
            int size = 0;

            MetaMetadataOneLevelNestingEnumerator fullEnumerator = FullNonRecursiveMetaMetadataIterator();

            // iterate over all fields in this & then in each mixin of this
            while (fullEnumerator.MoveNext())
            {
                MetaMetadataField metaMetadataField = fullEnumerator.Current;
                MetaMetadataField metaMetadata      = fullEnumerator.CurrentObject();        // stays the same for until we
                // iterate over all mfd's for
                // it
                Metadata currentMetadata = fullEnumerator.CurrentMetadata;

                // When the iterator enters the metadata in the mixins "this" in getValueString has to be
                // the corresponding metadata in mixin.
                bool hasVisibleNonNullField = false;
                MetadataFieldDescriptor mfd = metaMetadataField.MetadataFieldDescriptor;

                if (metaMetadata.IsChildFieldDisplayed(metaMetadataField.Name))
                {
                    if (mfd.IsScalar && !mfd.IsCollection)
                    {
                        hasVisibleNonNullField = MetadataString.IsNotNullAndEmptyValue(mfd.GetValueString(currentMetadata));
                    }
                    else if (mfd.IsComposite)
                    {
                        Metadata nestedMetadata = (Metadata)mfd.GetNestedMetadata(currentMetadata);
                        hasVisibleNonNullField = (nestedMetadata != null) ? (nestedMetadata.NumberOfVisibleFields() > 0) : false;
                    }
                    else if (mfd.IsCollection)
                    {
                        ICollection collection = mfd.GetCollection(currentMetadata);
                        hasVisibleNonNullField = (collection != null) ? (collection.Count > 0) : false;
                    }
                }

                // "null" happens with mixins fieldAccessor b'coz getValueString() returns "null".

                // TODO use MetaMetadataField.numNonDisplayedFields()
                bool isVisibleField = !metaMetadataField.Hide &&
                                      ((considerAlwaysShow && metaMetadataField.AlwaysShow) || hasVisibleNonNullField);

                if (isVisibleField)
                {
                    size++;
                }
            }

            return(size);
        }
        public void DeserializationPreHook(Object e, FieldDescriptor fd)
        {
            var deserializedMetadata = e as Metadata;

            if (deserializedMetadata == null)
            {
                return;
            }

            if (_currentMMStack.Count == 0)
            {
                MetaMetadataCompositeField deserializationMM = deserializedMetadata.MetaMetadata;
//					MetaMetadataCompositeField metaMetadata				= semanticsSessionScope.getMetaMetadataRepository().getByClass(InformationComposition.class);
//					if (metaMetadata != null && metaMetadata.bindMetaMetadataToMetadata(deserializationMM))
//					{
//						metaMetadata = (MetaMetadata) deserializationMM;
//					}
//					else
//					{
//						deserializedMetadata.setMetaMetadata(metaMetadata);
//					}
                _currentMMStack.Push(deserializationMM);
            }
            else if (fd is MetadataFieldDescriptor)
            {
                MetadataFieldDescriptor mfd = (MetadataFieldDescriptor)fd;
                String mmName = mfd.MmName;
                MetaMetadataNestedField    currentMM        = _currentMMStack.Peek();
                MetaMetadataNestedField    childMMNested    = (MetaMetadataNestedField)currentMM.LookupChild(mmName);
                MetaMetadataCompositeField childMMComposite = null;
                if (childMMNested.IsPolymorphicInherently)
                {
                    String tagName = deserializedMetadata.MetadataClassDescriptor.TagName;
                    childMMComposite = _semanticsSessionScope.MetaMetadataRepository.GetMMByName(tagName);
                }
                else
                {
                    childMMComposite = childMMNested.GetMetaMetadataCompositeField();
                }
                deserializedMetadata.MetaMetadata = childMMComposite;
                _currentMMStack.Push(childMMComposite);
            }

            if (e is Document)
            {
                ((Document)e).SemanticsSessionScope = _semanticsSessionScope;
            }
        }
コード例 #4
0
        /**
         * For the root, compare the meta-metadata from the binding with the one we started with. Down the
         * hierarchy, try to perform similar bindings.
         */
        public void DeserializationPreHook(MetadataNS.Metadata deserializedMetadata, MetadataFieldDescriptor mfd)
        {
            if (deserializingRoot)
            {
                deserializingRoot							= false;
                Document document							= GetDocument();
                MetaMetadataCompositeField preMM			= document.MetaMetadata;
                MetadataClassDescriptor mcd					= (MetadataClassDescriptor) ClassDescriptor.GetClassDescriptor(deserializedMetadata);;
                MetaMetadataCompositeField metaMetadata;
                String tagName 								= mcd.TagName;
                if (preMM.GetTagForTranslationScope().Equals(tagName))
                {
                    metaMetadata							= preMM;
                }
                else
                {	// just match in translation scope
                    //TODO use local TranslationScope if there is one
                    metaMetadata							= SemanticsSessionScope.MetaMetadataRepository.GetMMByName(tagName);
                }
                deserializedMetadata.MetaMetadata = metaMetadata;

                currentMMstack.Push(metaMetadata);
            }
            else
            {
                String mmName = mfd.MmName;
                MetaMetadataNestedField currentMM = currentMMstack.Peek();
                MetaMetadataNestedField childMMNested = (MetaMetadataNestedField) currentMM.LookupChild(mmName); // this fails for collections :-(
                if (childMMNested == null)
                    throw new Exception("Can't find composite child meta-metadata for " + mmName + " amidst "+ mfd +
                            "\n\tThis probably means there is a conflict between the meta-metadata repository and the runtime."+
                            "\n\tProgrammer: Have you Changed the fields in built-in Metadata subclasses without updating primitives.xml???!");
                MetaMetadataCompositeField childMMComposite = null;
                if (childMMNested.IsPolymorphicInherently)
                {
                    String tagName = ClassDescriptor.GetClassDescriptor(deserializedMetadata).TagName;
                    childMMComposite = SemanticsSessionScope.MetaMetadataRepository.GetMMByName(tagName);
                }
                else
                {
                    childMMComposite = childMMNested.GetMetaMetadataCompositeField();
                }
                deserializedMetadata.MetaMetadata = childMMComposite;
                currentMMstack.Push(childMMComposite);
            }
        }
コード例 #5
0
 public void deserializationPostHook(MetadataNS.Metadata deserializedMetadata, MetadataFieldDescriptor mfd)
 {
     currentMMstack.Pop();
 }