[jOOQ/jOOQ#11136] Add Name.qualifierQualified() to check if a Name's qualifier (if any) is qualified as well

This commit is contained in:
Lukas Eder 2020-12-17 09:58:50 +01:00
parent bb65927b1b
commit 2f943d6c7c
3 changed files with 22 additions and 1 deletions

View File

@ -156,10 +156,21 @@ public interface Name extends QueryPart, Comparable<Name> {
/**
* Whether this is a qualified name.
* <p>
* This is <code>true</code> as soon as {@link #getName()} has a length of more than <code>1</code>.
* This is <code>true</code> as soon as {@link #getName()} has a length of
* more than <code>1</code> and {@link #qualifier()} is not null.
*/
boolean qualified();
/**
* Whether this is a qualified name and the {@link #qualifier()} is also a
* qualified name.
* <p>
* This is <code>true</code> as soon as {@link #getName()} has a length of
* more than <code>2</code> and {@link #qualifier()} is not null and its
* {@link #qualified()} property is also true.
*/
boolean qualifierQualified();
/**
* This name's qualifier (if it is {@link #qualified()}), or <code>null</code>.
*/

View File

@ -192,6 +192,11 @@ final class QualifiedName extends AbstractName {
return qualifiedName.length > 1;
}
@Override
public final boolean qualifierQualified() {
return qualifiedName.length > 2;
}
@Override
public final Name qualifier() {
if (qualifiedName.length <= 1)

View File

@ -106,6 +106,11 @@ final class UnqualifiedName extends AbstractName {
return false;
}
@Override
public final boolean qualifierQualified() {
return false;
}
@Override
public final Name qualifier() {
return null;