All Downloads are FREE. Search and download functionalities are using the official Maven repository.

csharp.libraries.generichost.modelGeneric.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
    /// 
    /// {{description}}{{^description}}{{classname}}{{/description}}
    /// 
    {{>visibility}} partial class {{classname}}{{#lambda.firstDot}}{{#parent}} : .{{/parent}}{{#validatable}} : .{{/validatable}}{{#equatable}}{{#readOnlyVars}}{{#-first}} : .{{/-first}}{{/readOnlyVars}}{{/equatable}}{{/lambda.firstDot}}{{#lambda.joinWithComma}}{{#parent}}{{{.}}}  {{/parent}}{{>ImplementsIEquatable}}{{#validatable}}IValidatableObject  {{/validatable}}{{/lambda.joinWithComma}}
    {
        {{#composedSchemas.oneOf}}
        {{^vendorExtensions.x-duplicated-data-type}}
        /// 
        /// Initializes a new instance of the  class.
        /// 
        /// 
        {{#composedSchemas.anyOf}}
        /// 
        {{/composedSchemas.anyOf}}
        {{#allVars}}
        /// {{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}
        {{/allVars}}
        {{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{{dataType}}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}  {{#model.composedSchemas.anyOf}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}  {{/model.composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}  {{/parentModel.composedSchemas.oneOf}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}}
        {
            {{#composedSchemas.anyOf}}
            {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}};
            {{/composedSchemas.anyOf}}
            {{name}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}};
            {{#allVars}}
            {{^isInherited}}
            {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
            {{/isInherited}}
            {{#isInherited}}
            {{#isNew}}
            {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
            {{/isNew}}
            {{/isInherited}}
            {{/allVars}}
            OnCreated();
        }

        {{/vendorExtensions.x-duplicated-data-type}}
        {{/composedSchemas.oneOf}}
        {{^composedSchemas.oneOf}}
        /// 
        /// Initializes a new instance of the  class.
        /// 
        {{#composedSchemas.anyOf}}
        /// 
        {{/composedSchemas.anyOf}}
        {{#allVars}}
        /// {{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#defaultValue}} (default to {{.}}){{/defaultValue}}
        {{/allVars}}
        {{^composedSchemas.anyOf}}
        [JsonConstructor]
        {{/composedSchemas.anyOf}}
        {{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{#composedSchemas.anyOf}}{{^required}}Option<{{/required}}{{{name}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}  {{/composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}}
        {
            {{#composedSchemas.anyOf}}
            {{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
            {{/composedSchemas.anyOf}}
            {{#allVars}}
            {{^isInherited}}
            {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
            {{/isInherited}}
            {{#isInherited}}
            {{#isNew}}
            {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
            {{/isNew}}
            {{/isInherited}}
            {{/allVars}}
            OnCreated();
        }

        {{/composedSchemas.oneOf}}
        partial void OnCreated();

        {{#vars}}
        {{#items.isEnum}}
        {{#items}}
        {{^complexType}}
{{>modelInnerEnum}}
        {{/complexType}}
        {{/items}}
        {{/items.isEnum}}
        {{#isEnum}}
        {{^complexType}}
{{>modelInnerEnum}}
        {{/complexType}}
        {{/isEnum}}
        {{#isEnum}}
        {{^required}}
        /// 
        /// Used to track the state of {{{name}}}
        /// 
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}}

        {{/required}}
        /// 
        /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
        /// 
        {{#description}}
        /// {{.}}
        {{/description}}
        {{#example}}
        /// {{.}}
        {{/example}}
        [JsonPropertyName("{{baseName}}")]
        {{#deprecated}}
        [Obsolete]
        {{/deprecated}}
        public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}}  {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}  {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}

        {{/isEnum}}
        {{/vars}}
        {{#composedSchemas.anyOf}}
        {{^vendorExtensions.x-duplicated-data-type}}
        {{^required}}
        /// 
        /// Used to track the state of {{{name}}}
        /// 
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}}

        {{/required}}
        /// 
        /// {{description}}{{^description}}Gets or Sets {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}{{/description}}
        /// {{#description}}
        /// {{.}}{{/description}}
        {{#example}}
        /// {{.}}
        {{/example}}
        {{#deprecated}}
        [Obsolete]
        {{/deprecated}}
        public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}}  {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}  {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option; } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}

        {{/vendorExtensions.x-duplicated-data-type}}
        {{/composedSchemas.anyOf}}
        {{#composedSchemas.oneOf}}
        {{^vendorExtensions.x-duplicated-data-type}}
        /// 
        /// {{description}}{{^description}}Gets or Sets {{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}{{/description}}
        /// {{#description}}
        /// {{.}}{{/description}}
        {{#example}}
        /// {{.}}
        {{/example}}
        {{#deprecated}}
        [Obsolete]
        {{/deprecated}}
        public {{{dataType}}}{{>NullConditionalProperty}} {{#lambda.titlecase}}{{name}}{{/lambda.titlecase}} { get; {{^isReadOnly}}set; {{/isReadOnly}}}

        {{/vendorExtensions.x-duplicated-data-type}}
        {{/composedSchemas.oneOf}}
        {{#allVars}}
        {{^isEnum}}
        {{#isInherited}}
        {{#isNew}}
        {{^required}}
        /// 
        /// Used to track the state of {{{name}}}
        /// 
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public new Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}}

        {{/required}}
        /// 
        /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
        /// {{#description}}
        /// {{.}}{{/description}}
        {{#example}}
        /// {{.}}
        {{/example}}
        [JsonPropertyName("{{baseName}}")]
        {{#deprecated}}
        [Obsolete]
        {{/deprecated}}
        public new {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}}  {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}  {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}

        {{/isNew}}
        {{/isInherited}}
        {{^isInherited}}
        {{^required}}
        /// 
        /// Used to track the state of {{{name}}}
        /// 
        [JsonIgnore]
        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
        public Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}}

        {{/required}}
        /// 
        /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
        /// {{#description}}
        /// {{.}}{{/description}}
        {{#example}}
        /// {{.}}
        {{/example}}
        [JsonPropertyName("{{baseName}}")]
        {{#deprecated}}
        [Obsolete]
        {{/deprecated}}
        public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}}  {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}  {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this. {{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}}

        {{/isInherited}}
        {{/isEnum}}
        {{/allVars}}
        {{#isAdditionalPropertiesTrue}}
        {{^parentModel}}
        /// 
        /// Gets or Sets additional properties
        /// 
        [JsonExtensionData]
        public Dictionary AdditionalProperties { get; } = new Dictionary();

        {{/parentModel}}
        {{/isAdditionalPropertiesTrue}}
        /// 
        /// Returns the string presentation of the object
        /// 
        /// String presentation of the object
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class {{classname}} {\n");
            {{#parent}}
            sb.Append("  ").Append(base.ToString()?.Replace("\n", "\n  ")).Append("\n");
            {{/parent}}
            {{#vars}}
            sb.Append("  {{name}}: ").Append({{name}}).Append("\n");
            {{/vars}}
            {{#isAdditionalPropertiesTrue}}
            {{^parentModel}}
            sb.Append("  AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
            {{/parentModel}}
            {{/isAdditionalPropertiesTrue}}
            sb.Append("}\n");
            return sb.ToString();
        }
        {{#equatable}}
        {{#readOnlyVars}}
        {{#-first}}

        /// 
        /// Returns true if objects are equal
        /// 
        /// Object to be compared
        /// Boolean
        public override bool Equals(object{{nrt?}} input)
        {
            {{#useCompareNetObjects}}
            return OpenAPIClientUtils.compareLogic.Compare(this, input as {{classname}}).AreEqual;
            {{/useCompareNetObjects}}
            {{^useCompareNetObjects}}
            return this.Equals(input as {{classname}});
            {{/useCompareNetObjects}}
        }

        /// 
        /// Returns true if {{classname}} instances are equal
        /// 
        /// Instance of {{classname}} to be compared
        /// Boolean
        public bool Equals({{classname}}{{nrt?}} input)
        {
            {{#useCompareNetObjects}}
            return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
            {{/useCompareNetObjects}}
            {{^useCompareNetObjects}}
            if (input == null)
                return false;

            return {{#parent}}base.Equals(input) && {{/parent}}{{#readOnlyVars}}{{^isInherited}}{{^isContainer}}
                (
                    {{name}} == input.{{name}} ||
                    {{^vendorExtensions.x-is-value-type}}
                    ({{name}} != null &&
                    {{name}}.Equals(input.{{name}}))
                    {{/vendorExtensions.x-is-value-type}}
                    {{#vendorExtensions.x-is-value-type}}
                    {{name}}.Equals(input.{{name}})
                    {{/vendorExtensions.x-is-value-type}}
                ){{^-last}} && {{/-last}}{{/isContainer}}{{#isContainer}}
                (
                    {{name}} == input.{{name}} ||
                    {{^vendorExtensions.x-is-value-type}}{{name}} != null &&
                    input.{{name}} != null &&
                    {{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(input.{{name}})
                ){{^-last}} && {{/-last}}{{/isContainer}}{{/isInherited}}{{/readOnlyVars}}{{^readOnlyVars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/readOnlyVars}}{{^isAdditionalPropertiesTrue}};{{/isAdditionalPropertiesTrue}}
                {{#isAdditionalPropertiesTrue}}
                {{^parentModel}}
                && (AdditionalProperties.Count == input.AdditionalProperties.Count && !AdditionalProperties.Except(input.AdditionalProperties).Any());
                {{/parentModel}}
                {{/isAdditionalPropertiesTrue}}
            {{/useCompareNetObjects}}
        }

        /// 
        /// Gets the hash code
        /// 
        /// Hash code
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                {{#parent}}
                int hashCode = base.GetHashCode();
                {{/parent}}
                {{^parent}}
                int hashCode = 41;
                {{/parent}}
                {{#readOnlyVars}}
                {{#required}}
                {{^isNullable}}
                hashCode = (hashCode * 59) + {{name}}.GetHashCode();
                {{/isNullable}}
                {{/required}}
                {{/readOnlyVars}}
                {{#readOnlyVars}}
                {{#lambda.copy}}

                if ({{name}} != null)
                    hashCode = (hashCode * 59) + {{name}}.GetHashCode();
                {{/lambda.copy}}
                {{#isNullable}}
                {{#lambda.pasteOnce}}{{/lambda.pasteOnce}}
                {{/isNullable}}
                {{^required}}
                {{#lambda.pasteOnce}}{{/lambda.pasteOnce}}
                {{/required}}
                {{/readOnlyVars}}
                {{#isAdditionalPropertiesTrue}}
                {{^parentModel}}
                hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode();
                {{/parentModel}}
                {{/isAdditionalPropertiesTrue}}

                return hashCode;
            }
        }
        {{/-first}}
        {{/readOnlyVars}}
        {{/equatable}}
{{#validatable}}
{{^parentModel}}

{{>validatable}}
{{/parentModel}}
{{/validatable}}
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy