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

org.itsallcode.jdbc.identifier.QualifiedIdentifier Maven / Gradle / Ivy

There is a newer version: 0.7.1
Show newest version
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("."));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy