com.github.davidmoten.rx.jdbc.Parameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxjava-jdbc Show documentation
Show all versions of rxjava-jdbc Show documentation
rx-java Observables for jdbc
package com.github.davidmoten.rx.jdbc;
import rx.functions.Func1;
/**
* Encapsulates a query parameter.
*/
final class Parameter {
private final String name;
/**
* Actual query parameter value to be encapsulated.
*/
private final Object value;
/**
* Constructor.
*
* @param parameter
*/
Parameter(Object value) {
this(null, value);
}
Parameter(String name, Object value) {
this.name = name;
this.value = value;
}
/**
* Returns the parameter value.
*
* @return
*/
Object value() {
return value;
}
boolean hasName() {
return name != null;
}
String name() {
return name;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
if (value instanceof String)
builder.append("'");
builder.append(value);
if (value instanceof String)
builder.append("'");
return builder.toString();
}
/**
* A conversion function for use in Observable.map().
*/
static final Func1
© 2015 - 2025 Weber Informatics LLC | Privacy Policy