org.itsallcode.jdbc.identifier.QualifiedIdentifier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simple-jdbc Show documentation
Show all versions of simple-jdbc Show documentation
Library to simplify using JDBC
package org.itsallcode.jdbc.identifier;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.joining;
import java.util.List;
/**
* A qualified identifier, e.g. table name and schema name.
*/
record QualifiedIdentifier(List id) implements Identifier {
/**
* Create a new qualified identifier.
*
* @param ids the IDs
* @return a new instance
*/
public static Identifier of(final Identifier... ids) {
return new QualifiedIdentifier(asList(ids));
}
@Override
public String toString() {
return quote();
}
@Override
public String quote() {
return id.stream().map(Identifier::quote).collect(joining("."));
}
}