[jOOQ/jOOQ#11812] Pull up Field.as() to SelectField.as()
This commit is contained in:
parent
17a145227a
commit
43b68b2935
@ -242,48 +242,6 @@ extends
|
||||
@NotNull
|
||||
<U> Field<U> convertTo(Class<U> toType, Function<? super U, ? extends T> to);
|
||||
|
||||
/**
|
||||
* Create an alias for this field.
|
||||
* <p>
|
||||
* Note that the case-sensitivity of the returned field depends on
|
||||
* {@link Settings#getRenderQuotedNames()}. By default, field aliases are
|
||||
* quoted, and thus case-sensitive in many SQL dialects!
|
||||
*
|
||||
* @param alias The alias name
|
||||
* @return The field alias
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
Field<T> as(String alias);
|
||||
|
||||
/**
|
||||
* Create an alias for this field.
|
||||
* <p>
|
||||
* Note that the case-sensitivity of the returned field depends on
|
||||
* {@link Settings#getRenderQuotedNames()} and the {@link Name}. By default,
|
||||
* field aliases are quoted, and thus case-sensitive in many SQL dialects -
|
||||
* use {@link DSL#unquotedName(String...)} for case-insensitive aliases.
|
||||
* <p>
|
||||
* If the argument {@link Name#getName()} is qualified, then the
|
||||
* {@link Name#last()} part will be used.
|
||||
*
|
||||
* @param alias The alias name
|
||||
* @return The field alias
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
Field<T> as(Name alias);
|
||||
|
||||
/**
|
||||
* Create an alias for this field based on another field's name.
|
||||
*
|
||||
* @param otherField The other field whose name this field is aliased with.
|
||||
* @return The field alias.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
Field<T> as(Field<?> otherField);
|
||||
|
||||
/**
|
||||
* The name of the field.
|
||||
* <p>
|
||||
|
||||
@ -37,6 +37,10 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import org.jooq.conf.Settings;
|
||||
import org.jooq.impl.DSL;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A <code>QueryPart</code> to be used exclusively in <code>SELECT</code>
|
||||
@ -48,4 +52,46 @@ package org.jooq;
|
||||
*/
|
||||
public interface SelectField<T> extends SelectFieldOrAsterisk, Named, Typed<T> {
|
||||
|
||||
/**
|
||||
* Create an alias for this field.
|
||||
* <p>
|
||||
* Note that the case-sensitivity of the returned field depends on
|
||||
* {@link Settings#getRenderQuotedNames()}. By default, field aliases are
|
||||
* quoted, and thus case-sensitive in many SQL dialects!
|
||||
*
|
||||
* @param alias The alias name
|
||||
* @return The field alias
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
Field<T> as(String alias);
|
||||
|
||||
/**
|
||||
* Create an alias for this field.
|
||||
* <p>
|
||||
* Note that the case-sensitivity of the returned field depends on
|
||||
* {@link Settings#getRenderQuotedNames()} and the {@link Name}. By default,
|
||||
* field aliases are quoted, and thus case-sensitive in many SQL dialects -
|
||||
* use {@link DSL#unquotedName(String...)} for case-insensitive aliases.
|
||||
* <p>
|
||||
* If the argument {@link Name#getName()} is qualified, then the
|
||||
* {@link Name#last()} part will be used.
|
||||
*
|
||||
* @param alias The alias name
|
||||
* @return The field alias
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
Field<T> as(Name alias);
|
||||
|
||||
/**
|
||||
* Create an alias for this field based on another field's name.
|
||||
*
|
||||
* @param otherField The other field whose name this field is aliased with.
|
||||
* @return The field alias.
|
||||
*/
|
||||
@NotNull
|
||||
@Support
|
||||
Field<T> as(Field<?> otherField);
|
||||
|
||||
}
|
||||
|
||||
@ -43,7 +43,6 @@ import static org.jooq.impl.Keywords.K_ROW;
|
||||
import static org.jooq.impl.QueryPartListView.wrap;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.jooq.Binding;
|
||||
@ -99,52 +98,67 @@ abstract class AbstractRow<R extends Record> extends AbstractQueryPart implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public Converter<?, R> getConverter() {
|
||||
public final Field<R> as(String alias) {
|
||||
return rf().as(alias);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Field<R> as(Name alias) {
|
||||
return rf().as(alias);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Field<R> as(Field<?> otherField) {
|
||||
return rf().as(otherField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Converter<?, R> getConverter() {
|
||||
return rf().getConverter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Binding<?, R> getBinding() {
|
||||
public final Binding<?, R> getBinding() {
|
||||
return rf().getBinding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<R> getType() {
|
||||
public final Class<R> getType() {
|
||||
return rf().getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataType<R> getDataType() {
|
||||
public final DataType<R> getDataType() {
|
||||
return rf().getDataType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataType<R> getDataType(Configuration configuration) {
|
||||
public final DataType<R> getDataType(Configuration configuration) {
|
||||
return rf().getDataType(configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public final String getName() {
|
||||
return rf().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name getQualifiedName() {
|
||||
public final Name getQualifiedName() {
|
||||
return rf().getQualifiedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name getUnqualifiedName() {
|
||||
public final Name getUnqualifiedName() {
|
||||
return rf().getUnqualifiedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComment() {
|
||||
public final String getComment() {
|
||||
return rf().getComment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comment getCommentPart() {
|
||||
public final Comment getCommentPart() {
|
||||
return rf().getCommentPart();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user