public NamingStrategy GetContainerNamingStrategy(JsonContainerAttribute containerAttribute) { if (containerAttribute.Internal().NamingStrategyInstance == null) { if (containerAttribute.Internal().NamingStrategyType == null) { return(null); } containerAttribute.Internal().NamingStrategyInstance = CreateNamingStrategyInstance(containerAttribute.Internal().NamingStrategyType, containerAttribute.Internal().NamingStrategyParameters); } return(containerAttribute.Internal().NamingStrategyInstance); }
/// <summary> /// Gets or sets a value that indicates whether to preserve object references. /// </summary> /// <value> /// <c>true</c> to keep object reference; otherwise, <c>false</c>. The default is <c>false</c>. /// </value> public void IsReference(JsonContainerAttribute attribute, bool value) { attribute.Internal().IsReference = value; }
/// <summary> /// Gets or sets a value that indicates whether to preserve object references. /// </summary> /// <value> /// <c>true</c> to keep object reference; otherwise, <c>false</c>. The default is <c>false</c>. /// </value> public bool IsReference(JsonContainerAttribute attribute) { return(attribute.Internal().IsReference ?? default(bool)); }
/// <summary> /// The parameter list to use when constructing the <see cref="NamingStrategy"/> described by <see cref="NamingStrategyType"/>. /// If <c>null</c>, the default constructor is used. /// When non-<c>null</c>, there must be a constructor defined in the <see cref="NamingStrategy"/> that exactly matches the number, /// order, and type of these parameters. /// </summary> /// <example> /// <code> /// [JsonContainer(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })] /// </code> /// </example> public void NamingStrategyParameters(JsonContainerAttribute attribute, object[] value) { attribute.Internal().NamingStrategyParameters = value; attribute.Internal().NamingStrategyInstance = null; }
/// <summary> /// The parameter list to use when constructing the <see cref="NamingStrategy"/> described by <see cref="NamingStrategyType"/>. /// If <c>null</c>, the default constructor is used. /// When non-<c>null</c>, there must be a constructor defined in the <see cref="NamingStrategy"/> that exactly matches the number, /// order, and type of these parameters. /// </summary> /// <example> /// <code> /// [JsonContainer(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })] /// </code> /// </example> public object[] NamingStrategyParameters(JsonContainerAttribute attribute) { return(attribute.Internal().NamingStrategyParameters); }
/// <summary> /// Gets or sets the <see cref="Type"/> of the <see cref="NamingStrategy"/>. /// </summary> /// <value>The <see cref="Type"/> of the <see cref="NamingStrategy"/>.</value> public void NamingStrategyType(JsonContainerAttribute attribute, Type value) { attribute.Internal().NamingStrategyType = value; attribute.Internal().NamingStrategyInstance = null; }
/// <summary> /// Gets or sets the <see cref="Type"/> of the <see cref="NamingStrategy"/>. /// </summary> /// <value>The <see cref="Type"/> of the <see cref="NamingStrategy"/>.</value> public Type NamingStrategyType(JsonContainerAttribute attribute) { return(attribute.Internal().NamingStrategyType); }
/// <summary> /// Initializes a new instance of the <see cref="JsonContainerAttribute"/> class with the specified container Id. /// </summary> /// <param name="id">The container Id.</param> public void New(JsonContainerAttribute attribute, string id) { attribute.Internal().Id = id; }
/// <summary> /// Gets or sets the type name handling used when serializing the collection's items. /// </summary> /// <value>The type name handling.</value> public void ItemTypeNameHandling(JsonContainerAttribute attribute, TypeNameHandling value) { attribute.Internal().ItemTypeNameHandling = value; }
/// <summary> /// Gets or sets the type name handling used when serializing the collection's items. /// </summary> /// <value>The type name handling.</value> public TypeNameHandling ItemTypeNameHandling(JsonContainerAttribute attribute) { return(attribute.Internal().ItemTypeNameHandling ?? default(TypeNameHandling)); }
/// <summary> /// Gets or sets the reference loop handling used when serializing the collection's items. /// </summary> /// <value>The reference loop handling.</value> public void ItemReferenceLoopHandling(JsonContainerAttribute attribute, ReferenceLoopHandling value) { attribute.Internal().ItemReferenceLoopHandling = value; }
/// <summary> /// Gets or sets the reference loop handling used when serializing the collection's items. /// </summary> /// <value>The reference loop handling.</value> public ReferenceLoopHandling ItemReferenceLoopHandling(JsonContainerAttribute attribute) { return(attribute.Internal().ItemReferenceLoopHandling ?? default(ReferenceLoopHandling)); }