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

com.twilio.twiml.voice.Parameter Maven / Gradle / Ivy

There is a newer version: 10.1.5
Show newest version
/**
 * This code was generated by
 * \ / _    _  _|   _  _
 *  | (_)\/(_)(_|\/| |(/_  v1.0.0
 *       /       /
 */

package com.twilio.twiml.voice;

import com.twilio.twiml.TwiML;

import java.util.HashMap;
import java.util.Map;

/**
 * TwiML wrapper for {@code }
 */
public class Parameter extends TwiML {
    private final String name;
    private final String value;

    /**
     * For XML Serialization/Deserialization
     */
    private Parameter() {
        this(new Builder());
    }

    /**
     * Create a new {@code } element
     */
    private Parameter(Builder b) {
        super("Parameter", b);
        this.name = b.name;
        this.value = b.value;
    }

    /**
     * Attributes to set on the generated XML element
     *
     * @return A Map of attribute keys to values
     */
    protected Map getElementAttributes() {
        // Preserve order of attributes
        Map attrs = new HashMap<>();

        if (this.getName() != null) {
            attrs.put("name", this.getName());
        }
        if (this.getValue() != null) {
            attrs.put("value", this.getValue());
        }

        return attrs;
    }

    /**
     * The name of the custom parameter
     *
     * @return The name of the custom parameter
     */
    public String getName() {
        return name;
    }

    /**
     * The value of the custom parameter
     *
     * @return The value of the custom parameter
     */
    public String getValue() {
        return value;
    }

    /**
     * Create a new {@code } element
     */
    public static class Builder extends TwiML.Builder {
        private String name;
        private String value;

        /**
         * The name of the custom parameter
         */
        public Builder name(String name) {
            this.name = name;
            return this;
        }

        /**
         * The value of the custom parameter
         */
        public Builder value(String value) {
            this.value = value;
            return this;
        }

        /**
         * Create and return resulting {@code } element
         */
        public Parameter build() {
            return new Parameter(this);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy