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

com.jaregu.database.queries.compiling.ConstantPart Maven / Gradle / Ivy

Go to download

Java based SQL templating project. Store your queries in *.sql files and build queries for execution. Supports simple expressions and conditional clauses and interface proxying for java-sql bridge.

There is a newer version: 1.4.1
Show newest version
package com.jaregu.database.queries.compiling;

import static java.util.Objects.requireNonNull;

import java.util.Collections;
import java.util.Optional;

import com.jaregu.database.queries.building.ParametersResolver;

final class ConstantPart implements PreparedQueryPart {

	private final String constant;
	private final Result result;

	ConstantPart(String constant) {
		this.constant = requireNonNull(constant);
		this.result = new PreparedQueryPartResultImpl(Optional.of(constant), Collections.emptyList(),
				Collections.emptyMap());
	}

	@Override
	public String toString() {
		return constant;
	}

	@Override
	public Result build(ParametersResolver resolver) {
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (obj == this) {
			return true;
		}
		if (obj instanceof ConstantPart) {
			return constant.equals(((ConstantPart) obj).constant);
		}
		return false;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy