com.tvd12.ezydata.database.query.EzyQueryData Maven / Gradle / Ivy
The newest version!
package com.tvd12.ezydata.database.query;
import lombok.Getter;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
public class EzyQueryData extends EzyQLQuery {
@Getter
private final Map parameterMap;
protected EzyQueryData(Builder builder) {
super(builder);
this.parameterMap = builder.parameterMap != null
? builder.parameterMap
: Collections.emptyMap();
}
public static Builder builder() {
return new Builder();
}
@Override
protected String createValue() {
return query;
}
public Object[] getParameters() {
return parameters;
}
public static class Builder extends EzyQLQuery.Builder {
private Map parameterMap;
@Override
public Builder query(String query) {
return (Builder) super.query(query);
}
public Builder parameterCount(int count) {
return (Builder) super.parameterCount(count);
}
public Builder parameter(String name, Object value) {
if (parameterMap == null) {
this.parameterMap = new HashMap<>();
}
this.parameterMap.put(name, value);
return this;
}
public Builder parameter(int index, boolean value) {
return (Builder) super.parameter(index, (Object) value);
}
public Builder parameter(int index, byte value) {
return (Builder) super.parameter(index, (Object) value);
}
public Builder parameter(int index, char value) {
return (Builder) super.parameter(index, (Object) value);
}
public Builder parameter(int index, double value) {
return (Builder) super.parameter(index, (Object) value);
}
public Builder parameter(int index, float value) {
return (Builder) super.parameter(index, (Object) value);
}
public Builder parameter(int index, int value) {
return (Builder) super.parameter(index, (Object) value);
}
public Builder parameter(int index, long value) {
return (Builder) super.parameter(index, (Object) value);
}
public Builder parameter(int index, short value) {
return (Builder) super.parameter(index, (Object) value);
}
public Builder parameter(int index, Object value) {
return (Builder) super.parameter(index, value);
}
public Builder parameters(Map parameters) {
if (parameterMap == null) {
this.parameterMap = new HashMap<>();
}
this.parameterMap.putAll(parameters);
return this;
}
public Builder parameters(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy