Removed AbstractFieldProviderQueryPart

This commit is contained in:
Lukas Eder 2013-02-08 12:24:06 +01:00
parent 9da6913287
commit d51a7b53dc
18 changed files with 32 additions and 114 deletions

View File

@ -1,89 +0,0 @@
/**
* Copyright (c) 2009-2013, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.impl;
import java.util.ArrayList;
import java.util.List;
import org.jooq.Field;
import org.jooq.Record;
/**
* @author Lukas Eder
*/
abstract class AbstractFieldProviderQueryPart<R extends Record> extends AbstractQueryPart {
/**
* Generated UID
*/
private static final long serialVersionUID = -4629861305735726005L;
AbstractFieldProviderQueryPart() {
super();
}
public final List<Field<?>> getFields() {
return new ArrayList<Field<?>>(getFieldList());
}
public final <T> Field<T> getField(Field<T> field) {
return getFieldList().field(field);
}
public final Field<?> getField(String name) {
return getFieldList().field(name);
}
public final Field<?> getField(int index) {
return getFieldList().field(index);
}
public final int getIndex(Field<?> field) {
return getFieldList().indexOf(field);
}
public final int getIndex(String fieldName) {
return getFieldList().indexOf(fieldName);
}
/**
* Subclasses should override this method to provide the set of fields
* contained in the concrete table implementation. For example, a
* <code>TableAlias</code> contains aliased fields of its
* <code>AliasProvider</code> table.
*/
protected abstract FieldList getFieldList();
}

View File

@ -64,7 +64,7 @@ import org.jooq.tools.StringUtils;
/**
* @author Lukas Eder
*/
abstract class AbstractTable<R extends Record> extends AbstractFieldProviderQueryPart<R> implements Table<R> {
abstract class AbstractTable<R extends Record> extends AbstractQueryPart implements Table<R> {
/**
* Generated UID
@ -89,10 +89,18 @@ abstract class AbstractTable<R extends Record> extends AbstractFieldProviderQuer
// XXX: TableLike API
// ------------------------------------------------------------------------
/**
* Subclasses should override this method to provide the set of fields
* contained in the concrete table implementation. For example, a
* <code>TableAlias</code> contains aliased fields of its
* <code>AliasProvider</code> table.
*/
abstract FieldList fields0();
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public final Row fieldsRow() {
return new RowImpl(getFieldList());
return new RowImpl(fields0());
}
@Override

View File

@ -286,8 +286,8 @@ class ArrayTable extends AbstractTable<Record> {
}
@Override
protected final FieldList getFieldList() {
return ArrayTable.this.getFieldList();
final FieldList fields0() {
return ArrayTable.this.fields0();
}
}
@ -297,7 +297,7 @@ class ArrayTable extends AbstractTable<Record> {
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return field;
}
}

View File

@ -127,7 +127,7 @@ class ArrayTableSimulation extends AbstractTable<Record> {
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return field;
}

View File

@ -125,7 +125,7 @@ class Dual extends AbstractTable<Record> {
public final void bind(BindContext context) {}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return new FieldList();
}
}

View File

@ -102,7 +102,7 @@ class FunctionTable<R extends Record> extends AbstractTable<R> {
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return new FieldList();
}
}

View File

@ -289,7 +289,7 @@ class JoinTable extends AbstractTable<Record> implements TableOptionalOnStep, Ta
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
Field<?>[] l = lhs.asTable().fields();
Field<?>[] r = rhs.asTable().fields();
Field<?>[] all = new Field[l.length + r.length];

View File

@ -287,8 +287,8 @@ implements
}
@Override
protected FieldList getFieldList() {
return Pivot.this.getFieldList();
final FieldList fields0() {
return Pivot.this.fields0();
}
}
@ -321,7 +321,7 @@ implements
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return new FieldList();
}

View File

@ -95,7 +95,7 @@ class QualifiedTable extends AbstractTable<Record> {
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return new FieldList();
}
}

View File

@ -90,7 +90,7 @@ class SQLTable extends AbstractTable<Record> {
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return new FieldList();
}
}

View File

@ -68,7 +68,7 @@ class SelectQueryAsTable<R extends Record> extends AbstractTable<R> {
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return new FieldList(query.getSelect());
}

View File

@ -145,7 +145,7 @@ class TableAlias<R extends Record> extends AbstractTable<R> {
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return aliasedFields;
}

View File

@ -62,7 +62,7 @@ class TableFieldImpl<R extends Record, T> extends AbstractField<T> implements Ta
// [#1199] The public API of Table returns immutable field lists
if (table instanceof TableImpl) {
((TableImpl<?>) table).getFieldList().add(this);
((TableImpl<?>) table).fields0().add(this);
}
}

View File

@ -97,7 +97,7 @@ public class TableImpl<R extends Record> extends AbstractTable<R> {
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return fields;
}

View File

@ -61,7 +61,7 @@ class UDTFieldImpl<R extends UDTRecord<R>, T> extends AbstractField<T> implement
// [#1199] The public API of UDT returns immutable field lists
if (udt instanceof UDTImpl) {
((UDTImpl<?>) udt).getFieldList().add(this);
((UDTImpl<?>) udt).fields0().add(this);
}
}

View File

@ -54,7 +54,7 @@ import org.jooq.UDTRecord;
*
* @author Lukas Eder
*/
public class UDTImpl<R extends UDTRecord<R>> extends AbstractFieldProviderQueryPart<R> implements UDT<R> {
public class UDTImpl<R extends UDTRecord<R>> extends AbstractQueryPart implements UDT<R> {
private static final long serialVersionUID = -2208672099190913126L;
@ -105,8 +105,7 @@ public class UDTImpl<R extends UDTRecord<R>> extends AbstractFieldProviderQueryP
return fieldsRow().fields();
}
@Override
protected final FieldList getFieldList() {
final FieldList fields0() {
return fields;
}

View File

@ -157,7 +157,7 @@ class Values<R extends Record> extends AbstractTable<R> {
}
@Override
protected final FieldList getFieldList() {
protected final FieldList fields0() {
return new FieldList(rows[0].fields());
}
}

View File

@ -95,7 +95,7 @@ class WithTable<R extends Record> extends AbstractTable<R> {
}
@Override
protected final FieldList getFieldList() {
return delegate.getFieldList();
final FieldList fields0() {
return delegate.fields0();
}
}