From Dave: a bunch of @Override annotating and some other cleanup.
This commit is contained in:
@@ -42,7 +42,7 @@ public interface CacheInvalidator
|
||||
|
||||
public void invalidate (PersistenceContext ctx) {
|
||||
ctx.cacheTraverse(_cacheId, new PersistenceContext.CacheEvictionFilter<T>() {
|
||||
protected boolean testForEviction (Serializable key, T record) {
|
||||
@Override protected boolean testForEviction (Serializable key, T record) {
|
||||
return TraverseWithFilter.this.testForEviction(key, record);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -565,7 +565,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
|
||||
// check to see if our schema version table exists, create it if not
|
||||
ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
liaison.createTableIfMissing(
|
||||
conn, SCHEMA_VERSION_TABLE,
|
||||
new String[] { "persistentClass", "version" },
|
||||
@@ -592,7 +592,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
}
|
||||
final Iterable<Index> indexen = _indexes.values();
|
||||
ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
// create the table
|
||||
String[] primaryKeyColumns = null;
|
||||
if (_pkColumns != null) {
|
||||
@@ -640,7 +640,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
|
||||
// make sure the versions match
|
||||
int currentVersion = ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
String query =
|
||||
" select " + liaison.columnSQL("version") +
|
||||
" from " + liaison.tableSQL(SCHEMA_VERSION_TABLE) +
|
||||
@@ -693,7 +693,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
final ColumnDefinition coldef = fmarsh.getColumnDefinition();
|
||||
log.info("Adding column to " + getTableName() + ": " + fmarsh.getColumnName());
|
||||
ctx.invoke(new Modifier.Simple() {
|
||||
protected String createQuery (DatabaseLiaison liaison) {
|
||||
@Override protected String createQuery (DatabaseLiaison liaison) {
|
||||
return "alter table " + liaison.tableSQL(getTableName()) +
|
||||
" add column " + liaison.columnSQL(fmarsh.getColumnName()) + " " +
|
||||
liaison.expandDefinition(coldef);
|
||||
@@ -709,7 +709,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
coldef.getType().equalsIgnoreCase("datetime"))) {
|
||||
log.info("Assigning current time to " + fmarsh.getColumnName() + ".");
|
||||
ctx.invoke(new Modifier.Simple() {
|
||||
protected String createQuery (DatabaseLiaison liaison) {
|
||||
@Override protected String createQuery (DatabaseLiaison liaison) {
|
||||
// TODO: is NOW() standard SQL?
|
||||
return "update " + liaison.tableSQL(getTableName()) +
|
||||
" set " + liaison.columnSQL(fmarsh.getColumnName()) + " = NOW()";
|
||||
@@ -722,7 +722,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
if (hasPrimaryKey() && metaData.pkName == null) {
|
||||
log.info("Adding primary key.");
|
||||
ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
liaison.addPrimaryKey(
|
||||
conn, getTableName(), fieldsToColumns(getPrimaryKeyFields()));
|
||||
return 0;
|
||||
@@ -733,7 +733,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
final String pkName = metaData.pkName;
|
||||
log.info("Dropping primary key: " + pkName);
|
||||
ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
liaison.dropPrimaryKey(conn, getTableName(), pkName);
|
||||
return 0;
|
||||
}
|
||||
@@ -750,7 +750,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
}
|
||||
// but this is a new, named index, so we create it
|
||||
ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
liaison.addIndexToTable(
|
||||
conn, getTableName(), fieldsToColumns(index.fields()),
|
||||
ixName, index.unique());
|
||||
@@ -785,7 +785,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
final String[] colArr = colSet.toArray(new String[colSet.size()]);
|
||||
final String fName = indexName;
|
||||
ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
liaison.addIndexToTable(conn, getTableName(), colArr, fName, true);
|
||||
return 0;
|
||||
}
|
||||
@@ -806,7 +806,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
|
||||
// but not this one, so let's create it
|
||||
ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
builder.addFullTextSearch(conn, DepotMarshaller.this, recordFts);
|
||||
return 0;
|
||||
}
|
||||
@@ -832,7 +832,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
// last of all (re-)initialize our value generators, since one might've been added
|
||||
if (_valueGenerators.size() > 0) {
|
||||
ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
for (ValueGenerator vg : _valueGenerators.values()) {
|
||||
vg.init(conn, liaison);
|
||||
}
|
||||
@@ -843,7 +843,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
|
||||
// record our new version in the database
|
||||
ctx.invoke(new Modifier() {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
updateVersion(conn, liaison, _schemaVersion);
|
||||
return 0;
|
||||
}
|
||||
@@ -916,7 +916,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
throws PersistenceException
|
||||
{
|
||||
return ctx.invoke(new Query.TrivialQuery<TableMetaData>() {
|
||||
public TableMetaData invoke (Connection conn, DatabaseLiaison dl)
|
||||
@Override public TableMetaData invoke (Connection conn, DatabaseLiaison dl)
|
||||
throws SQLException {
|
||||
return new TableMetaData(conn.getMetaData(), tableName);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public abstract class DepotRepository
|
||||
|
||||
// key will be null if record was supplied without a primary key
|
||||
return _ctx.invoke(new CachingModifier<T>(record, key, key) {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
// set any auto-generated column values
|
||||
Set<String> identityFields =
|
||||
marsh.generateFieldValues(conn, liaison, _result, false);
|
||||
@@ -241,7 +241,7 @@ public abstract class DepotRepository
|
||||
builder.newQuery(update);
|
||||
|
||||
return _ctx.invoke(new CachingModifier<T>(record, key, key) {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
PreparedStatement stmt = builder.prepare(conn);
|
||||
try {
|
||||
return stmt.executeUpdate();
|
||||
@@ -282,7 +282,7 @@ public abstract class DepotRepository
|
||||
builder.newQuery(update);
|
||||
|
||||
return _ctx.invoke(new CachingModifier<T>(record, key, key) {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
PreparedStatement stmt = builder.prepare(conn);
|
||||
// clear out _result so that we don't rewrite this partial record to the cache
|
||||
_result = null;
|
||||
@@ -424,7 +424,7 @@ public abstract class DepotRepository
|
||||
builder.newQuery(update);
|
||||
|
||||
return _ctx.invoke(new Modifier(invalidator) {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
PreparedStatement stmt = builder.prepare(conn);
|
||||
try {
|
||||
return stmt.executeUpdate();
|
||||
@@ -556,7 +556,7 @@ public abstract class DepotRepository
|
||||
builder.newQuery(update);
|
||||
|
||||
return _ctx.invoke(new Modifier(invalidator) {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
PreparedStatement stmt = builder.prepare(conn);
|
||||
try {
|
||||
return stmt.executeUpdate();
|
||||
@@ -593,7 +593,7 @@ public abstract class DepotRepository
|
||||
|
||||
final boolean[] created = new boolean[1];
|
||||
_ctx.invoke(new CachingModifier<T>(record, key, key) {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
if (_key != null) {
|
||||
@@ -701,7 +701,7 @@ public abstract class DepotRepository
|
||||
builder.newQuery(delete);
|
||||
|
||||
return _ctx.invoke(new Modifier(invalidator) {
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
PreparedStatement stmt = builder.prepare(conn);
|
||||
try {
|
||||
return stmt.executeUpdate();
|
||||
|
||||
@@ -79,7 +79,7 @@ public class EHCacheAdapter
|
||||
public T getValue () {
|
||||
return value;
|
||||
}
|
||||
public String toString () {
|
||||
@Override public String toString () {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
};
|
||||
@@ -147,17 +147,17 @@ public class EHCacheAdapter
|
||||
/** A class to represent an explicitly Serializable concept of null for EHCache. */
|
||||
protected static class NullValue implements Serializable
|
||||
{
|
||||
public String toString ()
|
||||
@Override public String toString ()
|
||||
{
|
||||
return "<EHCache Null>";
|
||||
}
|
||||
|
||||
public boolean equals (Object other)
|
||||
@Override public boolean equals (Object other)
|
||||
{
|
||||
return other != null && other.getClass().equals(NullValue.class);
|
||||
}
|
||||
|
||||
public int hashCode ()
|
||||
@Override public int hashCode ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class EntityMigration extends Modifier
|
||||
_columnName = columnName;
|
||||
}
|
||||
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
if (!liaison.tableContainsColumn(conn, _tableName, _columnName)) {
|
||||
// we'll accept this inconsistency
|
||||
log.warning(_tableName + "." + _columnName + " already dropped.");
|
||||
@@ -72,7 +72,7 @@ public abstract class EntityMigration extends Modifier
|
||||
_newColumnName = newColumnName;
|
||||
}
|
||||
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
if (!liaison.tableContainsColumn(conn, _tableName, _oldColumnName)) {
|
||||
if (liaison.tableContainsColumn(conn, _tableName, _newColumnName)) {
|
||||
// we'll accept this inconsistency
|
||||
@@ -97,11 +97,11 @@ public abstract class EntityMigration extends Modifier
|
||||
conn, _tableName, _oldColumnName, _newColumnName, _newColumnDef) ? 1 : 0;
|
||||
}
|
||||
|
||||
public boolean runBeforeDefault () {
|
||||
@Override public boolean runBeforeDefault () {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
|
||||
@Override protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
|
||||
super.init(tableName, marshallers);
|
||||
_newColumnDef = marshallers.get(_newColumnName).getColumnDefinition();
|
||||
}
|
||||
@@ -122,18 +122,18 @@ public abstract class EntityMigration extends Modifier
|
||||
_fieldName = fieldName;
|
||||
}
|
||||
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
log.info("Updating type of '" + _fieldName + "' in " + _tableName);
|
||||
return liaison.changeColumn(conn, _tableName, _fieldName, _newColumnDef.getType(),
|
||||
_newColumnDef.isNullable(), _newColumnDef.isUnique(),
|
||||
_newColumnDef.getDefaultValue()) ? 1 : 0;
|
||||
}
|
||||
|
||||
public boolean runBeforeDefault () {
|
||||
@Override public boolean runBeforeDefault () {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
|
||||
@Override protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
|
||||
super.init(tableName, marshallers);
|
||||
_columnName = marshallers.get(_fieldName).getColumnName();
|
||||
_newColumnDef = marshallers.get(_fieldName).getColumnDefinition();
|
||||
|
||||
@@ -227,190 +227,190 @@ public abstract class FieldMarshaller<T>
|
||||
}
|
||||
|
||||
protected static class BooleanMarshaller extends FieldMarshaller<Boolean> {
|
||||
public Boolean getFromObject (Object po)
|
||||
@Override public Boolean getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return _field.getBoolean(po);
|
||||
}
|
||||
public Boolean getFromSet (ResultSet rs)
|
||||
@Override public Boolean getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return rs.getBoolean(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, Boolean value)
|
||||
@Override public void writeToObject (Object po, Boolean value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.setBoolean(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, Boolean value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, Boolean value)
|
||||
throws SQLException {
|
||||
ps.setBoolean(column, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class ByteMarshaller extends FieldMarshaller<Byte> {
|
||||
public Byte getFromObject (Object po)
|
||||
@Override public Byte getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return _field.getByte(po);
|
||||
}
|
||||
public Byte getFromSet (ResultSet rs)
|
||||
@Override public Byte getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return rs.getByte(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, Byte value)
|
||||
@Override public void writeToObject (Object po, Byte value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.setByte(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, Byte value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, Byte value)
|
||||
throws SQLException {
|
||||
ps.setByte(column, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class ShortMarshaller extends FieldMarshaller<Short> {
|
||||
public Short getFromObject (Object po)
|
||||
@Override public Short getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return _field.getShort(po);
|
||||
}
|
||||
public Short getFromSet (ResultSet rs)
|
||||
@Override public Short getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return rs.getShort(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, Short value)
|
||||
@Override public void writeToObject (Object po, Short value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.setShort(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, Short value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, Short value)
|
||||
throws SQLException {
|
||||
ps.setShort(column, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class IntMarshaller extends FieldMarshaller<Integer> {
|
||||
public Integer getFromObject (Object po)
|
||||
@Override public Integer getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return _field.getInt(po);
|
||||
}
|
||||
public Integer getFromSet (ResultSet rs)
|
||||
@Override public Integer getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return rs.getInt(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, Integer value)
|
||||
@Override public void writeToObject (Object po, Integer value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.setInt(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, Integer value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, Integer value)
|
||||
throws SQLException {
|
||||
ps.setInt(column, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class LongMarshaller extends FieldMarshaller<Long> {
|
||||
public Long getFromObject (Object po)
|
||||
@Override public Long getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return _field.getLong(po);
|
||||
}
|
||||
public Long getFromSet (ResultSet rs)
|
||||
@Override public Long getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return rs.getLong(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, Long value)
|
||||
@Override public void writeToObject (Object po, Long value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.setLong(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, Long value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, Long value)
|
||||
throws SQLException {
|
||||
ps.setLong(column, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class FloatMarshaller extends FieldMarshaller<Float> {
|
||||
public Float getFromObject (Object po)
|
||||
@Override public Float getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return _field.getFloat(po);
|
||||
}
|
||||
public Float getFromSet (ResultSet rs)
|
||||
@Override public Float getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return rs.getFloat(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, Float value)
|
||||
@Override public void writeToObject (Object po, Float value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.setFloat(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, Float value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, Float value)
|
||||
throws SQLException {
|
||||
ps.setFloat(column, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class DoubleMarshaller extends FieldMarshaller<Double> {
|
||||
public Double getFromObject (Object po)
|
||||
@Override public Double getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return _field.getDouble(po);
|
||||
}
|
||||
public Double getFromSet (ResultSet rs)
|
||||
@Override public Double getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return rs.getDouble(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, Double value)
|
||||
@Override public void writeToObject (Object po, Double value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.setDouble(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, Double value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, Double value)
|
||||
throws SQLException {
|
||||
ps.setDouble(column, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class ObjectMarshaller extends FieldMarshaller<Object> {
|
||||
public Object getFromObject (Object po)
|
||||
@Override public Object getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return _field.get(po);
|
||||
}
|
||||
public Object getFromSet (ResultSet rs)
|
||||
@Override public Object getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return rs.getObject(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, Object value)
|
||||
@Override public void writeToObject (Object po, Object value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.set(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, Object value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, Object value)
|
||||
throws SQLException {
|
||||
ps.setObject(column, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class ByteArrayMarshaller extends FieldMarshaller<byte[]> {
|
||||
public byte[] getFromObject (Object po)
|
||||
@Override public byte[] getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return (byte[]) _field.get(po);
|
||||
}
|
||||
public byte[] getFromSet (ResultSet rs)
|
||||
@Override public byte[] getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return rs.getBytes(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, byte[] value)
|
||||
@Override public void writeToObject (Object po, byte[] value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.set(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, byte[] value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, byte[] value)
|
||||
throws SQLException {
|
||||
ps.setBytes(column, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class IntArrayMarshaller extends FieldMarshaller<int[]> {
|
||||
public int[] getFromObject (Object po)
|
||||
@Override public int[] getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return (int[]) _field.get(po);
|
||||
}
|
||||
public int[] getFromSet (ResultSet rs)
|
||||
@Override public int[] getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
return (int[]) rs.getObject(getColumnName());
|
||||
}
|
||||
public void writeToObject (Object po, int[] value)
|
||||
@Override public void writeToObject (Object po, int[] value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.set(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, int[] value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, int[] value)
|
||||
throws SQLException {
|
||||
ps.setObject(column, value);
|
||||
}
|
||||
@@ -431,11 +431,11 @@ public abstract class FieldMarshaller<T>
|
||||
}
|
||||
}
|
||||
|
||||
public ByteEnum getFromObject (Object po)
|
||||
@Override public ByteEnum getFromObject (Object po)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
return (ByteEnum) _field.get(po);
|
||||
}
|
||||
public ByteEnum getFromSet (ResultSet rs)
|
||||
@Override public ByteEnum getFromSet (ResultSet rs)
|
||||
throws SQLException {
|
||||
try {
|
||||
return (ByteEnum) _factmeth.invoke(null, rs.getByte(getColumnName()));
|
||||
@@ -445,11 +445,11 @@ public abstract class FieldMarshaller<T>
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
public void writeToObject (Object po, ByteEnum value)
|
||||
@Override public void writeToObject (Object po, ByteEnum value)
|
||||
throws IllegalArgumentException, IllegalAccessException {
|
||||
_field.set(po, value);
|
||||
}
|
||||
public void writeToStatement (PreparedStatement ps, int column, ByteEnum value)
|
||||
@Override public void writeToStatement (PreparedStatement ps, int column, ByteEnum value)
|
||||
throws SQLException {
|
||||
ps.setByte(column, value.toByte());
|
||||
}
|
||||
|
||||
@@ -75,8 +75,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
return _values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals (Object obj)
|
||||
@Override public boolean equals (Object obj)
|
||||
{
|
||||
if (this == obj) {
|
||||
return true;
|
||||
@@ -88,8 +87,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
return _pClass == other._pClass && _values.equals(other.getValues());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode ()
|
||||
@Override public int hashCode ()
|
||||
{
|
||||
return _pClass.hashCode() ^ _values.hashCode();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class Modifier
|
||||
super(null);
|
||||
}
|
||||
|
||||
public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
@Override public int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException {
|
||||
Statement stmt = conn.createStatement();
|
||||
try {
|
||||
return stmt.executeUpdate(createQuery(liaison));
|
||||
|
||||
@@ -56,8 +56,7 @@ public class MySQLBuilder
|
||||
{
|
||||
public class MSBuildVisitor extends BuildVisitor
|
||||
{
|
||||
@Override
|
||||
public void visit (FullTextMatch match)
|
||||
@Override public void visit (FullTextMatch match)
|
||||
throws Exception
|
||||
{
|
||||
_builder.append("match(");
|
||||
@@ -73,8 +72,7 @@ public class MySQLBuilder
|
||||
_builder.append(") against (? in boolean mode)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit (DeleteClause<? extends PersistentRecord> deleteClause)
|
||||
@Override public void visit (DeleteClause<? extends PersistentRecord> deleteClause)
|
||||
throws Exception
|
||||
{
|
||||
_builder.append("delete from ");
|
||||
@@ -104,17 +102,17 @@ public class MySQLBuilder
|
||||
super(types);
|
||||
}
|
||||
|
||||
protected void appendTableName (Class<? extends PersistentRecord> type)
|
||||
@Override protected void appendTableName (Class<? extends PersistentRecord> type)
|
||||
{
|
||||
_builder.append(_types.getTableName(type));
|
||||
}
|
||||
|
||||
protected void appendTableAbbreviation (Class<? extends PersistentRecord> type)
|
||||
@Override protected void appendTableAbbreviation (Class<? extends PersistentRecord> type)
|
||||
{
|
||||
_builder.append(_types.getTableAbbreviation(type));
|
||||
}
|
||||
|
||||
protected void appendIdentifier (String field)
|
||||
@Override protected void appendIdentifier (String field)
|
||||
{
|
||||
_builder.append(field);
|
||||
}
|
||||
@@ -127,8 +125,7 @@ public class MySQLBuilder
|
||||
super(types, stmt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit (FullTextMatch match)
|
||||
@Override public void visit (FullTextMatch match)
|
||||
throws Exception
|
||||
{
|
||||
_stmt.setString(_argIdx ++, match.getQuery());
|
||||
|
||||
@@ -58,8 +58,7 @@ public class PostgreSQLBuilder
|
||||
{
|
||||
public class PGBuildVisitor extends BuildVisitor
|
||||
{
|
||||
@Override
|
||||
public void visit (FullTextMatch match)
|
||||
@Override public void visit (FullTextMatch match)
|
||||
throws Exception
|
||||
{
|
||||
appendIdentifier("ftsCol_" + match.getName());
|
||||
@@ -79,7 +78,7 @@ public class PostgreSQLBuilder
|
||||
super(types);
|
||||
}
|
||||
|
||||
protected void appendIdentifier (String field)
|
||||
@Override protected void appendIdentifier (String field)
|
||||
{
|
||||
_builder.append("\"").append(field).append("\"");
|
||||
}
|
||||
@@ -87,8 +86,7 @@ public class PostgreSQLBuilder
|
||||
|
||||
public class PGBindVisitor extends BindVisitor
|
||||
{
|
||||
@Override
|
||||
public void visit (FullTextMatch match)
|
||||
@Override public void visit (FullTextMatch match)
|
||||
throws Exception
|
||||
{
|
||||
// The tsearch2 engine takes queries on the form
|
||||
|
||||
@@ -42,8 +42,7 @@ public abstract class Arithmetic
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "+";
|
||||
}
|
||||
@@ -62,8 +61,7 @@ public abstract class Arithmetic
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
@@ -82,8 +80,7 @@ public abstract class Arithmetic
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "*";
|
||||
}
|
||||
@@ -102,8 +99,7 @@ public abstract class Arithmetic
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return " / "; // Pad with spaces to work-around a MySQL bug.
|
||||
}
|
||||
@@ -122,8 +118,7 @@ public abstract class Arithmetic
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "&";
|
||||
}
|
||||
@@ -142,8 +137,7 @@ public abstract class Arithmetic
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "|";
|
||||
}
|
||||
|
||||
@@ -85,8 +85,7 @@ public abstract class Conditionals
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "=";
|
||||
}
|
||||
@@ -105,8 +104,7 @@ public abstract class Conditionals
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "!=";
|
||||
}
|
||||
@@ -125,8 +123,7 @@ public abstract class Conditionals
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "<";
|
||||
}
|
||||
@@ -145,8 +142,7 @@ public abstract class Conditionals
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "<=";
|
||||
}
|
||||
@@ -165,8 +161,7 @@ public abstract class Conditionals
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return ">";
|
||||
}
|
||||
@@ -185,8 +180,7 @@ public abstract class Conditionals
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return ">=";
|
||||
}
|
||||
@@ -260,8 +254,7 @@ public abstract class Conditionals
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return " like ";
|
||||
}
|
||||
|
||||
@@ -47,8 +47,7 @@ public abstract class Logic
|
||||
super(conditions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "or";
|
||||
}
|
||||
@@ -69,8 +68,7 @@ public abstract class Logic
|
||||
super(conditions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String operator()
|
||||
@Override public String operator()
|
||||
{
|
||||
return "and";
|
||||
}
|
||||
|
||||
@@ -78,9 +78,7 @@ public class GenRecordTask extends Task
|
||||
_cloader = ClasspathUtils.getClassLoaderForPath(getProject(), pathref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the actual work of the task.
|
||||
*/
|
||||
@Override
|
||||
public void execute () throws BuildException
|
||||
{
|
||||
if (_cloader == null) {
|
||||
|
||||
Reference in New Issue
Block a user