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

io.swagger.models.properties.EmailProperty Maven / Gradle / Ivy

There is a newer version: 2.0.0-rc2
Show newest version
package io.swagger.models.properties;

import io.swagger.models.Xml;

import java.util.List;

import java.util.ArrayList;
import java.util.List;

public class EmailProperty extends StringProperty {
    public EmailProperty() {
        super.type = "string";
        super.format = "email";
    }

    public EmailProperty(StringProperty prop) {
        this();
        this._enum = prop.getEnum();
        this.minLength = prop.getMinLength();
        this.maxLength = prop.getMaxLength();
        this.pattern = prop.getPattern();
        this.name = prop.getName();
        this.type = prop.getType();
        this.example = prop.getExample();
        this._default = prop.getDefault();
        this.xml = prop.getXml();
        this.required = prop.getRequired();
        this.position = prop.getPosition();
        this.description = prop.getDescription();
        this.title = prop.getTitle();
        this.readOnly = prop.getReadOnly();
    }

    public EmailProperty _enum(String value) {
        if (this._enum == null) {
            this._enum = new ArrayList();
        }
        if (!_enum.contains(value)) {
            _enum.add(value);
        }
        return this;
    }

    public EmailProperty _enum(List value) {
        this._enum = value;
        return this;
    }

    public static boolean isType(String type, String format) {
        if ("string".equals(type) && "email".equals(format)) {
            return true;
        } else {
            return false;
        }
    }

    public EmailProperty xml(Xml xml) {
        super.xml(xml);
        return this;
    }

    public EmailProperty example(String example) {
        super.example(example);
        return this;
    }

    public EmailProperty minLength(Integer minLength) {
        super.minLength(minLength);
        return this;
    }

    public EmailProperty maxLength(Integer maxLength) {
        super.maxLength(maxLength);
        return this;
    }

    public EmailProperty pattern(String pattern) {
        super.pattern(pattern);
        return this;
    }

    public EmailProperty vendorExtension(String key, Object obj) {
        this.setVendorExtension(key, obj);
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy