jaskell.sql.Exists Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jaskell-java8 Show documentation
Show all versions of jaskell-java8 Show documentation
This is a utils library for java 8 project.
It include parsec combinators and sql generators library.
package jaskell.sql;
import jaskell.script.Directive;
import jaskell.script.Parameter;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Exists extends Predicate {
Optional _prefix;
Directive directive;
Exists(Directive directive){
_prefix = Optional.empty();
this.directive = directive;
}
@Override
public String script() {
if(_prefix.isPresent()) {
return String.format("%s EXISTS(%s)", _prefix.get().script(), directive.script());
}else {
return String.format("EXISTS(%s)", directive.script());
}
}
@Override
public List> parameters() {
if (_prefix.isPresent()){
return Stream.concat(_prefix.get().parameters().stream(), directive.parameters().stream())
.collect(Collectors.toList());
}else {
return directive.parameters();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy