[#1938] Improve AbstractField.hashCode() and AbstractTable.hashCode()

and similar, as these two are called very often
This commit is contained in:
Lukas Eder 2012-11-06 23:00:01 +01:00
parent 35b043286d
commit 041407b965
7 changed files with 92 additions and 8 deletions

View File

@ -97,7 +97,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
}
// ------------------------------------------------------------------------
// API (not implemented)
// XXX: API (not implemented)
// ------------------------------------------------------------------------
@Override
@ -110,7 +110,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
public abstract boolean isNullLiteral();
// ------------------------------------------------------------------------
// API
// XXX: API
// ------------------------------------------------------------------------
@Override
@ -139,7 +139,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
}
// ------------------------------------------------------------------------
// Type casts
// XXX: Type casts
// ------------------------------------------------------------------------
@Override
@ -166,7 +166,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
}
// ------------------------------------------------------------------------
// Conversion of field into a sort field
// XXX: Conversion of field into a sort field
// ------------------------------------------------------------------------
@Override
@ -241,7 +241,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
}
// ------------------------------------------------------------------------
// Arithmetic operations
// XXX: Arithmetic operations
// ------------------------------------------------------------------------
@Override
@ -308,7 +308,7 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
}
// ------------------------------------------------------------------------
// Conditions created from this field
// XXX: Conditions created from this field
// ------------------------------------------------------------------------
@Override
@ -933,8 +933,8 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
}
// ------------------------------------------------------------------------
// Pre-2.0 API. This API is maintained for backwards-compatibility. It will
// be removed in the future. Consider using equivalent methods from
// XXX: Pre-2.0 API. This API is maintained for backwards-compatibility. It
// will be removed in the future. Consider using equivalent methods from
// org.jooq.Factory
// ------------------------------------------------------------------------
@ -1602,4 +1602,16 @@ abstract class AbstractField<T> extends AbstractQueryPart implements Field<T> {
public final Field<T> coalesce(Field<T> option, Field<?>... options) {
return Factory.coalesce(this, Utils.combine(option, options));
}
// ------------------------------------------------------------------------
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public int hashCode() {
// [#1938] This is a much more efficient hashCode() implementation
// compared to that of standard QueryParts
return name.hashCode();
}
}

View File

@ -717,4 +717,16 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
return function(local.render(), getDataType(), array);
}
}
// ------------------------------------------------------------------------
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public int hashCode() {
// [#1938] This is a much more efficient hashCode() implementation
// compared to that of standard QueryParts
return name.hashCode();
}
}

View File

@ -369,4 +369,16 @@ abstract class AbstractTable<R extends Record> extends AbstractFieldProviderQuer
public final Table<Record> naturalRightOuterJoin(String sql, QueryPart... parts) {
return naturalRightOuterJoin(table(sql, parts));
}
// ------------------------------------------------------------------------
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public int hashCode() {
// [#1938] This is a much more efficient hashCode() implementation
// compared to that of standard QueryParts
return name.hashCode();
}
}

View File

@ -83,4 +83,16 @@ public class PackageImpl extends AbstractQueryPart implements Package {
@Override
public final void bind(BindContext context) {}
// ------------------------------------------------------------------------
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public int hashCode() {
// [#1938] This is a much more efficient hashCode() implementation
// compared to that of standard QueryParts
return name.hashCode();
}
}

View File

@ -93,4 +93,16 @@ class ParameterImpl<T> extends AbstractQueryPart implements Parameter<T> {
public final boolean isDefaulted() {
return isDefaulted;
}
// ------------------------------------------------------------------------
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public int hashCode() {
// [#1938] This is a much more efficient hashCode() implementation
// compared to that of standard QueryParts
return name.hashCode();
}
}

View File

@ -184,4 +184,16 @@ public class SequenceImpl<T extends Number> implements Sequence<T> {
return local.render();
}
}
// ------------------------------------------------------------------------
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public int hashCode() {
// [#1938] This is a much more efficient hashCode() implementation
// compared to that of standard QueryParts
return name.hashCode();
}
}

View File

@ -120,4 +120,16 @@ public class UDTImpl<R extends UDTRecord<R>> extends AbstractFieldProviderQueryP
protected static final <R extends UDTRecord<R>, T> UDTField<R, T> createField(String name, DataType<T> type, UDT<R> udt) {
return new UDTFieldImpl<R, T>(name, type, udt);
}
// ------------------------------------------------------------------------
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public int hashCode() {
// [#1938] This is a much more efficient hashCode() implementation
// compared to that of standard QueryParts
return name.hashCode();
}
}