/// <summary> /// Converts the given value object to the specified type, using the specified context and culture information. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param> /// <param name="culture">A <see cref="T:System.Globalization.CultureInfo"></see>. If null is passed, the current culture is assumed.</param> /// <param name="value">The <see cref="T:System.Object"></see> to convert.</param> /// <param name="destinationType">The <see cref="T:System.Type"></see> to convert the value parameter to.</param> /// <returns>An <see cref="System.Object"></see> that represents the converted value.</returns> /// <exception cref="System.ArgumentNullException">destinationType</exception> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException(nameof(destinationType)); } if (destinationType == UnderlyingType && NameableType.IsInstanceOfType(value)) { return(value); } if (destinationType == typeof(InstanceDescriptor)) { return(new InstanceDescriptor(NameableType.GetConstructor(new[] { UnderlyingType }), new[] { value }, true)); } if (value == null) { if (destinationType == typeof(string)) { return(string.Empty); } } else if (UnderlyingTypeConverter != null) { return(UnderlyingTypeConverter.ConvertTo(context, culture, value, destinationType)); } return(base.ConvertTo(context, culture, value, destinationType)); }
/// <summary> /// Assemble SDMX nameable artefact. /// </summary> /// <param name="assembleInto"> /// The assemble into. /// </param> /// <param name="assembleFrom"> /// The assemble from. /// </param> public void AssembleNameable(NameableType assembleInto, INameableObject assembleFrom) { this.AssembleIdentifiable(assembleInto, assembleFrom); IList<ITextTypeWrapper> names = assembleFrom.Names; if (ObjectUtil.ValidCollection(names)) { this.GetTextType(names, assembleInto.Name); } IList<ITextTypeWrapper> descriptions = assembleFrom.Descriptions; if (ObjectUtil.ValidCollection(descriptions)) { this.GetTextType(descriptions, assembleInto.Description); } }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="SchemeMapCore"/> class. /// </summary> /// <param name="createdFrom"> /// The created from. /// </param> /// <param name="structureType"> /// The structure type. /// </param> /// <param name="parent"> /// The parent. /// </param> internal SchemeMapCore(NameableType createdFrom, SdmxStructureType structureType, IIdentifiableObject parent) : base(createdFrom, structureType, parent) { }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="ItemSchemeMapCore"/> class. /// </summary> /// <param name="createdFrom"> /// The created from. /// </param> /// <param name="structureType"> /// The structure type. /// </param> /// <param name="parent"> /// The parent. /// </param> protected ItemSchemeMapCore(NameableType createdFrom, SdmxStructureType structureType, IIdentifiableObject parent) : base(createdFrom, structureType, parent) { this._items = new List<IItemMap>(); }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM READER ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// // public NameableCore(SdmxStructureType structure, SdmxReader reader, IIdentifiableObject parent) { // super(structure, reader, parent); // string maintainableNode = reader.getCurrentElement(); // while(reader.peek().equals("Name")) { // reader.moveNextElement(); // string lang = reader.getAttributeValue("lang", false); // name.add(new TextTypeWrapperImpl(lang, reader.getCurrentElementValue(), this)); // } // while(reader.peek().equals("Description")) { // reader.moveNextElement(); // string lang = reader.getAttributeValue("lang", false); // description.add(new TextTypeWrapperImpl(lang, reader.getCurrentElementValue(), this)); // } // if(!reader.getCurrentElement().equals(maintainableNode)) { // reader.moveBackToElement(maintainableNode); // } // validateNameableAttributes(); // } /////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="NameableCore"/> class. /// </summary> /// <param name="createdFrom"> /// The created from. /// </param> /// <param name="structureType"> /// The structure type. /// </param> /// <param name="parent"> /// The parent. /// </param> protected NameableCore(NameableType createdFrom, SdmxStructureType structureType, IIdentifiableObject parent) : base(createdFrom, structureType, parent) { this.name = new List<ITextTypeWrapper>(); this.description = new List<ITextTypeWrapper>(); this.name = TextTypeUtil.WrapTextTypeV21(createdFrom.Name, this); this.description = TextTypeUtil.WrapTextTypeV21(createdFrom.Description, this); this.ValidateNameableAttributes(); }