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.8.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}}{{{dataType}}}{{>NullConditionalProperty}} {{#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}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}};
            {{/composedSchemas.anyOf}}
            {{name}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}};
            {{#allVars}}
            {{^isInherited}}
            {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
            {{/isInherited}}
            {{#isInherited}}
            {{#isNew}}
            {{name}} = {{#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}}{{{name}}}{{>NullConditionalProperty}} {{#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}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
            {{/composedSchemas.anyOf}}
            {{#allVars}}
            {{^isInherited}}
            {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
            {{/isInherited}}
            {{#isInherited}}
            {{#isNew}}
            {{name}} = {{#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}}
        /// 
        /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
        /// 
        {{#description}}
        /// {{.}}
        {{/description}}
        {{#example}}
        /// {{.}}
        {{/example}}
        [JsonPropertyName("{{baseName}}")]
        {{#deprecated}}
        [Obsolete]
        {{/deprecated}}
        public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}}

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

        {{/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}}
        /// 
        /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
        /// {{#description}}
        /// {{.}}{{/description}}
        {{#example}}
        /// {{.}}
        {{/example}}
        [JsonPropertyName("{{baseName}}")]
        {{#deprecated}}
        [Obsolete]
        {{/deprecated}}
        public new {{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}}

        {{/isNew}}
        {{/isInherited}}
        {{^isInherited}}
        /// 
        /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
        /// {{#description}}
        /// {{.}}{{/description}}
        {{#example}}
        /// {{.}}
        {{/example}}
        [JsonPropertyName("{{baseName}}")]
        {{#deprecated}}
        [Obsolete]
        {{/deprecated}}
        public {{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}}

        {{/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}}
                {{^isNullable}}
                hashCode = (hashCode * 59) + {{name}}.GetHashCode();
                {{/isNullable}}
                {{/readOnlyVars}}
                {{#readOnlyVars}}
                {{#isNullable}}

                if ({{name}} != null)
                    hashCode = (hashCode * 59) + {{name}}.GetHashCode();
                {{/isNullable}}
                {{/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