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

com.github.davidmoten.rx.jdbc.Parameter Maven / Gradle / Ivy

There is a newer version: 0.7.19
Show newest version
package com.github.davidmoten.rx.jdbc;

import rx.functions.Func1;

/**
 * Encapsulates a query parameter.
 */
final class Parameter {

    /**
     * Actual query parameter value to be encapsulated.
     */
    private final Object parameter;

    /**
     * Constructor.
     * 
     * @param parameter
     */
    Parameter(Object parameter) {
        super();
        this.parameter = parameter;
    }

    /**
     * Returns the parameter value.
     * 
     * @return
     */
    Object getValue() {
        return parameter;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Parameter [parameter=");
        builder.append(parameter);
        builder.append("]");
        return builder.toString();
    }

    /**
     * A conversion function for use in Observable.map().
     */
    static final Func1 TO_PARAMETER = new Func1() {

        @Override
        public Parameter call(Object parameter) {
            Conditions.checkFalse(parameter instanceof Parameter);
            return new Parameter(parameter);
        }
    };

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy