/// <inheritdoc/> public override void VisitPrimitive(object primitive, PrimitiveDescriptor descriptor) { if (CurrentPath.Match(MemberPath)) VisitAssetMember(primitive, descriptor); else base.VisitPrimitive(primitive, descriptor); }
/// <summary> /// Creates a type descriptor for the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns>An instance of type descriptor.</returns> protected virtual ITypeDescriptor Create(Type type) { ITypeDescriptor descriptor; // The order of the descriptors here is important if (PrimitiveDescriptor.IsPrimitive(type)) { descriptor = new PrimitiveDescriptor(this, type); } else if (DictionaryDescriptor.IsDictionary(type)) // resolve dictionary before collections, as they are also collections { // IDictionary descriptor = new DictionaryDescriptor(this, type); } else if (CollectionDescriptor.IsCollection(type)) { // ICollection descriptor = new CollectionDescriptor(this, type); } else if (type.IsArray) { // array[] descriptor = new ArrayDescriptor(this, type); } else if (NullableDescriptor.IsNullable(type)) { descriptor = new NullableDescriptor(this, type); } else { // standard object (class or value type) descriptor = new ObjectDescriptor(this, type); } return descriptor; }
/// <summary> /// Creates a type descriptor for the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns>An instance of type descriptor.</returns> protected virtual ITypeDescriptor Create(Type type) { ITypeDescriptor descriptor; // The order of the descriptors here is important if (PrimitiveDescriptor.IsPrimitive(type)) { descriptor = new PrimitiveDescriptor(this, type, emitDefaultValues, namingConvention); } else if (DictionaryDescriptor.IsDictionary(type)) // resolve dictionary before collections, as they are also collections { // IDictionary descriptor = new DictionaryDescriptor(this, type, emitDefaultValues, namingConvention); } else if (CollectionDescriptor.IsCollection(type)) { // ICollection descriptor = new CollectionDescriptor(this, type, emitDefaultValues, namingConvention); } else if (type.IsArray) { // array[] descriptor = new ArrayDescriptor(this, type, emitDefaultValues, namingConvention); } else if (NullableDescriptor.IsNullable(type)) { descriptor = new NullableDescriptor(this, type, emitDefaultValues, namingConvention); } else { // standard object (class or value type) descriptor = new ObjectDescriptor(this, type, emitDefaultValues, namingConvention); } return(descriptor); }
public virtual void VisitPrimitive(object primitive, PrimitiveDescriptor descriptor) { }