Le metric crapload of generics cleanup.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2350 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -37,7 +37,7 @@ public class SimpleRepository extends Repository
|
||||
public static interface PreCondition
|
||||
{
|
||||
/** See {@link #setExecutePreCondition}. */
|
||||
public boolean validate (String dbident, Operation op);
|
||||
public boolean validate (String dbident, Operation<?> op);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ public class SimpleRepository extends Repository
|
||||
* @return whatever value is returned by the invoked operation.
|
||||
*/
|
||||
protected <V> V execute (Operation<V> op)
|
||||
throws PersistenceException
|
||||
throws PersistenceException
|
||||
{
|
||||
return execute(op, true, true);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class SimpleRepository extends Repository
|
||||
* @return whatever value is returned by the invoked operation.
|
||||
*/
|
||||
protected <V> V executeUpdate (Operation<V> op)
|
||||
throws PersistenceException
|
||||
throws PersistenceException
|
||||
{
|
||||
return execute(op, true, false);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class SimpleRepository extends Repository
|
||||
* @return whatever value is returned by the invoked operation.
|
||||
*/
|
||||
protected <V> V execute (Operation<V> op, boolean retryOnTransientFailure, boolean readOnly)
|
||||
throws PersistenceException
|
||||
throws PersistenceException
|
||||
{
|
||||
Connection conn = null;
|
||||
DatabaseLiaison liaison = null;
|
||||
|
||||
@@ -194,14 +194,12 @@ public class StaticConnectionProvider implements ConnectionProvider
|
||||
public void shutdown ()
|
||||
{
|
||||
// close all of the connections
|
||||
Iterator iter = _keys.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String key = (String)iter.next();
|
||||
Mapping conmap = _keys.get(key);
|
||||
for (Map.Entry<String, Mapping> entry : _keys.entrySet()) {
|
||||
Mapping conmap = entry.getValue();
|
||||
try {
|
||||
conmap.connection.close();
|
||||
} catch (SQLException sqe) {
|
||||
log.warning("Error shutting down connection [key=" + key + ", err=" + sqe + "].");
|
||||
log.warning("Error shutting down connection", "key", entry.getKey(), "err", sqe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class TransitionRepository extends SimpleRepository
|
||||
/**
|
||||
* Perform a transition if it has not already been applied, and record that it was applied.
|
||||
*/
|
||||
public void transition (Class clazz, String name, Transition trans)
|
||||
public void transition (Class<?> clazz, String name, Transition trans)
|
||||
throws PersistenceException
|
||||
{
|
||||
if (!isTransitionApplied(clazz, name)) {
|
||||
@@ -94,7 +94,7 @@ public class TransitionRepository extends SimpleRepository
|
||||
/**
|
||||
* Has the specified name transition been applied.
|
||||
*/
|
||||
public boolean isTransitionApplied (Class clazz, final String name)
|
||||
public boolean isTransitionApplied (Class<?> clazz, final String name)
|
||||
throws PersistenceException
|
||||
{
|
||||
final String cname = clazz.getName();
|
||||
@@ -130,7 +130,7 @@ public class TransitionRepository extends SimpleRepository
|
||||
* @return true if the transition was noted, false if it could not be noted because another
|
||||
* process noted it first.
|
||||
*/
|
||||
public boolean noteTransition (Class clazz, final String name)
|
||||
public boolean noteTransition (Class<?> clazz, final String name)
|
||||
throws PersistenceException
|
||||
{
|
||||
final String cname = clazz.getName();
|
||||
@@ -168,7 +168,7 @@ public class TransitionRepository extends SimpleRepository
|
||||
/**
|
||||
* Clear the transition.
|
||||
*/
|
||||
public void clearTransition (Class clazz, final String name)
|
||||
public void clearTransition (Class<?> clazz, final String name)
|
||||
throws PersistenceException
|
||||
{
|
||||
final String cname = clazz.getName();
|
||||
|
||||
@@ -73,14 +73,14 @@ public class BindVisitor implements ExpressionVisitor
|
||||
public void visit (WhereCondition<? extends PersistentRecord> whereCondition)
|
||||
throws Exception
|
||||
{
|
||||
for (Comparable value : whereCondition.getValues()) {
|
||||
for (Comparable<?> value : whereCondition.getValues()) {
|
||||
if (value != null) {
|
||||
_stmt.setObject(_argIdx ++, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void visit (Key key)
|
||||
public void visit (Key<? extends PersistentRecord> key)
|
||||
throws Exception
|
||||
{
|
||||
key.condition.accept(this);
|
||||
@@ -89,12 +89,13 @@ public class BindVisitor implements ExpressionVisitor
|
||||
public void visit (MultiKey<? extends PersistentRecord> key)
|
||||
throws Exception
|
||||
{
|
||||
for (Map.Entry entry : key.getSingleFieldsMap().entrySet()) {
|
||||
|
||||
for (Map.Entry<String, Comparable<?>> entry : key.getSingleFieldsMap().entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
_stmt.setObject(_argIdx ++, entry.getValue());
|
||||
}
|
||||
}
|
||||
Comparable[] values = key.getMultiValues();
|
||||
Comparable<?>[] values = key.getMultiValues();
|
||||
for (int ii = 0; ii < values.length; ii++) {
|
||||
_stmt.setObject(_argIdx ++, values[ii]);
|
||||
}
|
||||
@@ -130,7 +131,7 @@ public class BindVisitor implements ExpressionVisitor
|
||||
|
||||
public void visit (In in) throws Exception
|
||||
{
|
||||
Comparable[] values = in.getValues();
|
||||
Comparable<?>[] values = in.getValues();
|
||||
for (int ii = 0; ii < values.length; ii++) {
|
||||
_stmt.setObject(_argIdx ++, values[ii]);
|
||||
}
|
||||
@@ -229,7 +230,7 @@ public class BindVisitor implements ExpressionVisitor
|
||||
|
||||
public void visit (UpdateClause<? extends PersistentRecord> updateClause) throws Exception
|
||||
{
|
||||
DepotMarshaller marsh = _types.getMarshaller(updateClause.getPersistentClass());
|
||||
DepotMarshaller<?> marsh = _types.getMarshaller(updateClause.getPersistentClass());
|
||||
|
||||
// bind the update arguments
|
||||
String[] fields = updateClause.getFields();
|
||||
@@ -251,7 +252,7 @@ public class BindVisitor implements ExpressionVisitor
|
||||
|
||||
public void visit (InsertClause<? extends PersistentRecord> insertClause) throws Exception
|
||||
{
|
||||
DepotMarshaller marsh = _types.getMarshaller(insertClause.getPersistentClass());
|
||||
DepotMarshaller<?> marsh = _types.getMarshaller(insertClause.getPersistentClass());
|
||||
|
||||
Object pojo = insertClause.getPojo();
|
||||
Set<String> idFields = insertClause.getIdentityFields();
|
||||
|
||||
@@ -98,7 +98,7 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
||||
{
|
||||
Class<? extends PersistentRecord> pClass = whereCondition.getPersistentClass();
|
||||
String[] keyFields = Key.getKeyFields(pClass);
|
||||
List<Comparable> values = whereCondition.getValues();
|
||||
List<Comparable<?>> values = whereCondition.getValues();
|
||||
for (int ii = 0; ii < keyFields.length; ii ++) {
|
||||
if (ii > 0) {
|
||||
_builder.append(" and ");
|
||||
@@ -113,7 +113,7 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
||||
}
|
||||
}
|
||||
|
||||
public void visit (Key key)
|
||||
public void visit (Key<? extends PersistentRecord> key)
|
||||
throws Exception
|
||||
{
|
||||
_builder.append(" where ");
|
||||
@@ -125,7 +125,7 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
||||
{
|
||||
_builder.append(" where ");
|
||||
boolean first = true;
|
||||
for (Map.Entry<String, Comparable> entry : key.getSingleFieldsMap().entrySet()) {
|
||||
for (Map.Entry<String, Comparable<?>> entry : key.getSingleFieldsMap().entrySet()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
@@ -145,7 +145,7 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
||||
appendRhsColumn(key.getPersistentClass(), key.getMultiField());
|
||||
_builder.append(" in (");
|
||||
|
||||
Comparable[] values = key.getMultiValues();
|
||||
Comparable<?>[] values = key.getMultiValues();
|
||||
for (int ii = 0; ii < values.length; ii ++) {
|
||||
if (ii > 0) {
|
||||
_builder.append(", ");
|
||||
@@ -206,7 +206,7 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
||||
{
|
||||
in.getColumn().accept(this);
|
||||
_builder.append(" in (");
|
||||
Comparable[] values = in.getValues();
|
||||
Comparable<?>[] values = in.getValues();
|
||||
for (int ii = 0; ii < values.length; ii ++) {
|
||||
if (ii > 0) {
|
||||
_builder.append(", ");
|
||||
@@ -465,7 +465,7 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
||||
throws Exception
|
||||
{
|
||||
Class<? extends PersistentRecord> pClass = insertClause.getPersistentClass();
|
||||
DepotMarshaller marsh = _types.getMarshaller(pClass);
|
||||
DepotMarshaller<?> marsh = _types.getMarshaller(pClass);
|
||||
_innerClause = true;
|
||||
|
||||
String[] fields = marsh.getColumnFieldNames();
|
||||
@@ -514,8 +514,8 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
||||
protected void appendLhsColumn (Class<? extends PersistentRecord> type, String field)
|
||||
throws Exception
|
||||
{
|
||||
DepotMarshaller dm = _types.getMarshaller(type);
|
||||
FieldMarshaller fm = dm.getFieldMarshaller(field);
|
||||
DepotMarshaller<?> dm = _types.getMarshaller(type);
|
||||
FieldMarshaller<?> fm = dm.getFieldMarshaller(field);
|
||||
if (dm == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unknown field on persistent record [record=" + type + ", field=" + field + "]");
|
||||
@@ -529,8 +529,8 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
||||
protected void appendRhsColumn (Class<? extends PersistentRecord> type, String field)
|
||||
throws Exception
|
||||
{
|
||||
DepotMarshaller dm = _types.getMarshaller(type);
|
||||
FieldMarshaller fm = dm.getFieldMarshaller(field);
|
||||
DepotMarshaller<?> dm = _types.getMarshaller(type);
|
||||
FieldMarshaller<?> fm = dm.getFieldMarshaller(field);
|
||||
if (dm == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unknown field on persistent record [record=" + type + ", field=" + field + "]");
|
||||
|
||||
@@ -120,14 +120,14 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
continue;
|
||||
}
|
||||
|
||||
FieldMarshaller fm = FieldMarshaller.createMarshaller(field);
|
||||
FieldMarshaller<?> fm = FieldMarshaller.createMarshaller(field);
|
||||
_fields.put(field.getName(), fm);
|
||||
fields.add(field.getName());
|
||||
|
||||
// check to see if this is our primary key
|
||||
if (field.getAnnotation(Id.class) != null) {
|
||||
if (_pkColumns == null) {
|
||||
_pkColumns = new ArrayList<FieldMarshaller>();
|
||||
_pkColumns = new ArrayList<FieldMarshaller<?>>();
|
||||
}
|
||||
_pkColumns.add(fm);
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
String[] conFields = constraint.fieldNames();
|
||||
Set<String> colSet = new HashSet<String>();
|
||||
for (int ii = 0; ii < conFields.length; ii ++) {
|
||||
FieldMarshaller fm = _fields.get(conFields[ii]);
|
||||
FieldMarshaller<?> fm = _fields.get(conFields[ii]);
|
||||
if (fm == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unknown unique constraint field: " + conFields[ii]);
|
||||
@@ -287,7 +287,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
/**
|
||||
* Returns the {@link FieldMarshaller} for a named field on our persistent class.
|
||||
*/
|
||||
public FieldMarshaller getFieldMarshaller (String fieldName)
|
||||
public FieldMarshaller<?> getFieldMarshaller (String fieldName)
|
||||
{
|
||||
return _fields.get(fieldName);
|
||||
}
|
||||
@@ -349,11 +349,11 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
}
|
||||
|
||||
try {
|
||||
Comparable[] values = new Comparable[_pkColumns.size()];
|
||||
Comparable<?>[] values = new Comparable<?>[_pkColumns.size()];
|
||||
int nulls = 0;
|
||||
for (int ii = 0; ii < _pkColumns.size(); ii++) {
|
||||
FieldMarshaller field = _pkColumns.get(ii);
|
||||
if ((values[ii] = (Comparable)field.getField().get(object)) == null) {
|
||||
FieldMarshaller<?> field = _pkColumns.get(ii);
|
||||
if ((values[ii] = (Comparable<?>)field.getField().get(object)) == null) {
|
||||
nulls++;
|
||||
}
|
||||
}
|
||||
@@ -383,7 +383,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
* Creates a primary key record for the type of object handled by this marshaller, using the
|
||||
* supplied primary key value.
|
||||
*/
|
||||
public Key<T> makePrimaryKey (Comparable... values)
|
||||
public Key<T> makePrimaryKey (Comparable<?>... values)
|
||||
{
|
||||
if (!hasPrimaryKey()) {
|
||||
throw new UnsupportedOperationException(
|
||||
@@ -407,14 +407,14 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
throw new UnsupportedOperationException(
|
||||
getClass().getName() + " does not define a primary key");
|
||||
}
|
||||
Comparable[] values = new Comparable[_pkColumns.size()];
|
||||
Comparable<?>[] values = new Comparable<?>[_pkColumns.size()];
|
||||
for (int ii = 0; ii < _pkColumns.size(); ii++) {
|
||||
Object keyValue = _pkColumns.get(ii).getFromSet(rs);
|
||||
if (!(keyValue instanceof Comparable)) {
|
||||
throw new IllegalArgumentException("Key field must be Comparable [field=" +
|
||||
if (!(keyValue instanceof Comparable<?>)) {
|
||||
throw new IllegalArgumentException("Key field must be Comparable<?> [field=" +
|
||||
_pkColumns.get(ii).getColumnName() + "]");
|
||||
}
|
||||
values[ii] = (Comparable) keyValue;
|
||||
values[ii] = (Comparable<?>) keyValue;
|
||||
}
|
||||
return makePrimaryKey(values);
|
||||
}
|
||||
@@ -445,7 +445,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
|
||||
// then create and populate the persistent object
|
||||
T po = _pClass.newInstance();
|
||||
for (FieldMarshaller fm : _fields.values()) {
|
||||
for (FieldMarshaller<?> fm : _fields.values()) {
|
||||
if (!fields.contains(fm.getColumnName())) {
|
||||
// this field was not in the result set, make sure that's OK
|
||||
if (fm.getComputed() != null && !fm.getComputed().required()) {
|
||||
@@ -530,7 +530,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
final SQLBuilder builder = ctx.getSQLBuilder(new DepotTypes(ctx, _pClass));
|
||||
|
||||
// perform the context-sensitive initialization of the field marshallers
|
||||
for (FieldMarshaller fm : _fields.values()) {
|
||||
for (FieldMarshaller<?> fm : _fields.values()) {
|
||||
fm.init(builder);
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
ColumnDefinition[] declarations = new ColumnDefinition[_allFields.length];
|
||||
int jj = 0;
|
||||
for (int ii = 0; ii < _allFields.length; ii++) {
|
||||
FieldMarshaller fm = _fields.get(_allFields[ii]);
|
||||
FieldMarshaller<?> fm = _fields.get(_allFields[ii]);
|
||||
// include all persistent non-computed fields
|
||||
ColumnDefinition colDef = fm.getColumnDefinition();
|
||||
if (colDef != null) {
|
||||
@@ -684,7 +684,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
|
||||
// add any missing columns
|
||||
for (String fname : _columnFields) {
|
||||
final FieldMarshaller fmarsh = _fields.get(fname);
|
||||
final FieldMarshaller<?> fmarsh = _fields.get(fname);
|
||||
if (metaData.tableColumns.remove(fmarsh.getColumnName())) {
|
||||
continue;
|
||||
}
|
||||
@@ -873,7 +873,7 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
throws PersistenceException
|
||||
{
|
||||
for (String fname : _columnFields) {
|
||||
FieldMarshaller fmarsh = _fields.get(fname);
|
||||
FieldMarshaller<?> fmarsh = _fields.get(fname);
|
||||
meta.tableColumns.remove(fmarsh.getColumnName());
|
||||
}
|
||||
for (String column : meta.tableColumns) {
|
||||
@@ -977,11 +977,11 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
protected Map<String, ValueGenerator> _valueGenerators = new HashMap<String, ValueGenerator>();
|
||||
|
||||
/** A field marshaller for each persistent field in our object. */
|
||||
protected Map<String, FieldMarshaller> _fields = new HashMap<String, FieldMarshaller>();
|
||||
protected Map<String, FieldMarshaller<?>> _fields = new HashMap<String, FieldMarshaller<?>>();
|
||||
|
||||
/** The field marshallers for our persistent object's primary key columns or null if it did not
|
||||
* define a primary key. */
|
||||
protected ArrayList<FieldMarshaller> _pkColumns;
|
||||
protected ArrayList<FieldMarshaller<?>> _pkColumns;
|
||||
|
||||
/** The persisent fields of our object, in definition order. */
|
||||
protected String[] _allFields;
|
||||
|
||||
@@ -78,7 +78,7 @@ public abstract class DepotRepository
|
||||
/**
|
||||
* Loads the persistent object that matches the specified primary key.
|
||||
*/
|
||||
protected <T extends PersistentRecord> T load (Class<T> type, Comparable primaryKey,
|
||||
protected <T extends PersistentRecord> T load (Class<T> type, Comparable<?> primaryKey,
|
||||
QueryClause... clauses)
|
||||
throws PersistenceException
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public abstract class DepotRepository
|
||||
/**
|
||||
* Loads the persistent object that matches the specified primary key.
|
||||
*/
|
||||
protected <T extends PersistentRecord> T load (Class<T> type, String ix, Comparable val,
|
||||
protected <T extends PersistentRecord> T load (Class<T> type, String ix, Comparable<?> val,
|
||||
QueryClause... clauses)
|
||||
throws PersistenceException
|
||||
{
|
||||
@@ -100,8 +100,8 @@ public abstract class DepotRepository
|
||||
/**
|
||||
* Loads the persistent object that matches the specified two-column primary key.
|
||||
*/
|
||||
protected <T extends PersistentRecord> T load (Class<T> type, String ix1, Comparable val1,
|
||||
String ix2, Comparable val2,
|
||||
protected <T extends PersistentRecord> T load (Class<T> type, String ix1, Comparable<?> val1,
|
||||
String ix2, Comparable<?> val2,
|
||||
QueryClause... clauses)
|
||||
throws PersistenceException
|
||||
{
|
||||
@@ -112,9 +112,9 @@ public abstract class DepotRepository
|
||||
/**
|
||||
* Loads the persistent object that matches the specified three-column primary key.
|
||||
*/
|
||||
protected <T extends PersistentRecord> T load (Class<T> type, String ix1, Comparable val1,
|
||||
String ix2, Comparable val2, String ix3,
|
||||
Comparable val3, QueryClause... clauses)
|
||||
protected <T extends PersistentRecord> T load (Class<T> type, String ix1, Comparable<?> val1,
|
||||
String ix2, Comparable<?> val2, String ix3,
|
||||
Comparable<?> val3, QueryClause... clauses)
|
||||
throws PersistenceException
|
||||
{
|
||||
clauses = ArrayUtil.append(clauses, new Key<T>(type, ix1, val1, ix2, val2, ix3, val3));
|
||||
@@ -231,7 +231,7 @@ public abstract class DepotRepository
|
||||
requireNotComputed(pClass, "update");
|
||||
|
||||
DepotMarshaller<T> marsh = _ctx.getMarshaller(pClass);
|
||||
Key key = marsh.getPrimaryKey(record);
|
||||
Key<T> key = marsh.getPrimaryKey(record);
|
||||
if (key == null) {
|
||||
throw new IllegalArgumentException("Can't update record with null primary key.");
|
||||
}
|
||||
@@ -269,7 +269,8 @@ public abstract class DepotRepository
|
||||
requireNotComputed(pClass, "updatePartial");
|
||||
|
||||
DepotMarshaller<T> marsh = _ctx.getMarshaller(pClass);
|
||||
Key key = marsh.getPrimaryKey(record);
|
||||
|
||||
Key<T> key = marsh.getPrimaryKey(record);
|
||||
|
||||
if (key == null) {
|
||||
throw new IllegalArgumentException("Can't update record with null primary key.");
|
||||
@@ -305,7 +306,7 @@ public abstract class DepotRepository
|
||||
* @return the number of rows modified by this action.
|
||||
*/
|
||||
protected <T extends PersistentRecord> int updatePartial (
|
||||
Class<T> type, Comparable primaryKey, Map<String,Object> updates)
|
||||
Class<T> type, Comparable<?> primaryKey, Map<String,Object> updates)
|
||||
throws PersistenceException
|
||||
{
|
||||
Object[] fieldsValues = new Object[updates.size()*2];
|
||||
@@ -328,7 +329,7 @@ public abstract class DepotRepository
|
||||
* @return the number of rows modified by this action.
|
||||
*/
|
||||
protected <T extends PersistentRecord> int updatePartial (
|
||||
Class<T> type, Comparable primaryKey, Object... fieldsValues)
|
||||
Class<T> type, Comparable<?> primaryKey, Object... fieldsValues)
|
||||
throws PersistenceException
|
||||
{
|
||||
return updatePartial(_ctx.getMarshaller(type).makePrimaryKey(primaryKey), fieldsValues);
|
||||
@@ -346,7 +347,7 @@ public abstract class DepotRepository
|
||||
* @return the number of rows modified by this action.
|
||||
*/
|
||||
protected <T extends PersistentRecord> int updatePartial (
|
||||
Class<T> type, String ix1, Comparable val1, String ix2, Comparable val2,
|
||||
Class<T> type, String ix1, Comparable<?> val1, String ix2, Comparable<?> val2,
|
||||
Object... fieldsValues)
|
||||
throws PersistenceException
|
||||
{
|
||||
@@ -365,8 +366,8 @@ public abstract class DepotRepository
|
||||
* @return the number of rows modified by this action.
|
||||
*/
|
||||
protected <T extends PersistentRecord> int updatePartial (
|
||||
Class<T> type, String ix1, Comparable val1, String ix2, Comparable val2,
|
||||
String ix3, Comparable val3, Object... fieldsValues)
|
||||
Class<T> type, String ix1, Comparable<?> val1, String ix2, Comparable<?> val2,
|
||||
String ix3, Comparable<?> val3, Object... fieldsValues)
|
||||
throws PersistenceException
|
||||
{
|
||||
return updatePartial(new Key<T>(type, ix1, val1, ix2, val2, ix3, val3), fieldsValues);
|
||||
@@ -452,7 +453,7 @@ public abstract class DepotRepository
|
||||
* @return the number of rows modified by this action.
|
||||
*/
|
||||
protected <T extends PersistentRecord> int updateLiteral (
|
||||
Class<T> type, Comparable primaryKey, Map<String, SQLExpression> fieldsToValues)
|
||||
Class<T> type, Comparable<?> primaryKey, Map<String, SQLExpression> fieldsToValues)
|
||||
throws PersistenceException
|
||||
{
|
||||
Key<T> key = _ctx.getMarshaller(type).makePrimaryKey(primaryKey);
|
||||
@@ -477,7 +478,7 @@ public abstract class DepotRepository
|
||||
* @return the number of rows modified by this action.
|
||||
*/
|
||||
protected <T extends PersistentRecord> int updateLiteral (
|
||||
Class<T> type, String ix1, Comparable val1, String ix2, Comparable val2,
|
||||
Class<T> type, String ix1, Comparable<?> val1, String ix2, Comparable<?> val2,
|
||||
Map<String, SQLExpression> fieldsToValues)
|
||||
throws PersistenceException
|
||||
{
|
||||
@@ -503,8 +504,8 @@ public abstract class DepotRepository
|
||||
* @return the number of rows modified by this action.
|
||||
*/
|
||||
protected <T extends PersistentRecord> int updateLiteral (
|
||||
Class<T> type, String ix1, Comparable val1, String ix2, Comparable val2,
|
||||
String ix3, Comparable val3, Map<String, SQLExpression> fieldsToValues)
|
||||
Class<T> type, String ix1, Comparable<?> val1, String ix2, Comparable<?> val2,
|
||||
String ix3, Comparable<?> val3, Map<String, SQLExpression> fieldsToValues)
|
||||
throws PersistenceException
|
||||
{
|
||||
Key<T> key = new Key<T>(type, ix1, val1, ix2, val2, ix3, val3);
|
||||
@@ -662,7 +663,8 @@ public abstract class DepotRepository
|
||||
*
|
||||
* @return the number of rows deleted by this action.
|
||||
*/
|
||||
protected <T extends PersistentRecord> int delete (Class<T> type, Comparable primaryKeyValue)
|
||||
protected <T extends PersistentRecord> int delete (
|
||||
Class<T> type, Comparable<?> primaryKeyValue)
|
||||
throws PersistenceException
|
||||
{
|
||||
return delete(type, _ctx.getMarshaller(type).makePrimaryKey(primaryKeyValue));
|
||||
@@ -714,7 +716,7 @@ public abstract class DepotRepository
|
||||
protected void requireNotComputed (Class<? extends PersistentRecord> type, String action)
|
||||
throws PersistenceException
|
||||
{
|
||||
DepotMarshaller marsh = _ctx.getMarshaller(type);
|
||||
DepotMarshaller<?> marsh = _ctx.getMarshaller(type);
|
||||
if (marsh == null) {
|
||||
throw new PersistenceException("Unknown persistent type [class=" + type + "]");
|
||||
}
|
||||
|
||||
@@ -152,9 +152,9 @@ public class DepotTypes
|
||||
*
|
||||
* @exception IllegalArgumentException thrown if the specified class is not known.
|
||||
*/
|
||||
public DepotMarshaller getMarshaller (Class<? extends PersistentRecord> cl)
|
||||
public DepotMarshaller<?> getMarshaller (Class<? extends PersistentRecord> cl)
|
||||
{
|
||||
DepotMarshaller marsh = _classMap.get(cl);
|
||||
DepotMarshaller<?> marsh = _classMap.get(cl);
|
||||
if (marsh == null) {
|
||||
throw new IllegalArgumentException("Persistent class not known: " + cl);
|
||||
}
|
||||
@@ -202,10 +202,11 @@ public class DepotTypes
|
||||
}
|
||||
|
||||
/** Classes mapped to integers, used for table abbreviation indexing. */
|
||||
protected Map<Class, Integer> _classIx = new HashMap<Class, Integer>();
|
||||
protected Map<Class<?>, Integer> _classIx = new HashMap<Class<?>, Integer>();
|
||||
|
||||
/** Classes mapped to marshallers, used for table names and field lists. */
|
||||
protected Map<Class, DepotMarshaller> _classMap = new HashMap<Class, DepotMarshaller>();
|
||||
protected Map<Class<?>, DepotMarshaller<?>> _classMap =
|
||||
new HashMap<Class<?>, DepotMarshaller<?>>();
|
||||
|
||||
/** When false, override the normal table abbreviations and return full table names instead. */
|
||||
protected boolean _useTableAbbreviations = true;
|
||||
|
||||
@@ -101,7 +101,7 @@ public abstract class EntityMigration extends Modifier
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void init (String tableName, Map<String,FieldMarshaller> marshallers) {
|
||||
protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
|
||||
super.init(tableName, marshallers);
|
||||
_newColumnDef = marshallers.get(_newColumnName).getColumnDefinition();
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public abstract class EntityMigration extends Modifier
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void init (String tableName, Map<String,FieldMarshaller> marshallers) {
|
||||
protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers) {
|
||||
super.init(tableName, marshallers);
|
||||
_columnName = marshallers.get(_fieldName).getColumnName();
|
||||
_newColumnDef = marshallers.get(_fieldName).getColumnDefinition();
|
||||
@@ -174,7 +174,7 @@ public abstract class EntityMigration extends Modifier
|
||||
* migration has been determined to be runnable so one cannot rely on this method having been
|
||||
* called in {@link #shouldRunMigration}.
|
||||
*/
|
||||
protected void init (String tableName, Map<String,FieldMarshaller> marshallers)
|
||||
protected void init (String tableName, Map<String,FieldMarshaller<?>> marshallers)
|
||||
{
|
||||
_tableName = tableName;
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ public abstract class FieldMarshaller<T>
|
||||
* Creates and returns a field marshaller for the specified field. Throws an exception if the
|
||||
* field in question cannot be marshalled.
|
||||
*/
|
||||
public static FieldMarshaller createMarshaller (Field field)
|
||||
public static FieldMarshaller<?> createMarshaller (Field field)
|
||||
{
|
||||
Class<?> ftype = field.getType();
|
||||
FieldMarshaller marshaller;
|
||||
FieldMarshaller<?> marshaller;
|
||||
|
||||
// primitive types
|
||||
if (ftype.equals(Boolean.TYPE)) {
|
||||
|
||||
@@ -117,7 +117,7 @@ public abstract class FindAllQuery<T extends PersistentRecord>
|
||||
|
||||
if (_marsh.getPrimaryKeyFields().length == 1) {
|
||||
// Single-column keys result in the compact IN(keyVal1, keyVal2, ...)
|
||||
Comparable[] keyFieldValues = new Comparable[fetchKeys.size()];
|
||||
Comparable<?>[] keyFieldValues = new Comparable<?>[fetchKeys.size()];
|
||||
int ii = 0;
|
||||
for (Key<T> key : fetchKeys) {
|
||||
keyFieldValues[ii ++] = key.condition.getValues().get(0);
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.samskivert.jdbc.depot.annotation.GeneratedValue;
|
||||
*/
|
||||
public class IdentityValueGenerator extends ValueGenerator
|
||||
{
|
||||
public IdentityValueGenerator (GeneratedValue gv, DepotMarshaller dm, FieldMarshaller fm)
|
||||
public IdentityValueGenerator (GeneratedValue gv, DepotMarshaller<?> dm, FieldMarshaller<?> fm)
|
||||
{
|
||||
super(gv, dm, fm);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.Serializable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -46,7 +47,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
public static class WhereCondition<U extends PersistentRecord>
|
||||
implements SQLExpression, Serializable
|
||||
{
|
||||
public WhereCondition (Class<U> pClass, ArrayList<Comparable> values)
|
||||
public WhereCondition (Class<U> pClass, ArrayList<Comparable<?>> values)
|
||||
{
|
||||
_pClass = pClass;
|
||||
_values = values;
|
||||
@@ -69,7 +70,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
return _pClass;
|
||||
}
|
||||
|
||||
public ArrayList<Comparable> getValues ()
|
||||
public ArrayList<Comparable<?>> getValues ()
|
||||
{
|
||||
return _values;
|
||||
}
|
||||
@@ -83,7 +84,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
WhereCondition other = (WhereCondition) obj;
|
||||
WhereCondition<?> other = (WhereCondition<?>) obj;
|
||||
return _pClass == other._pClass && _values.equals(other.getValues());
|
||||
}
|
||||
|
||||
@@ -94,7 +95,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
}
|
||||
|
||||
protected Class<U> _pClass;
|
||||
protected ArrayList<Comparable> _values;
|
||||
protected ArrayList<Comparable<?>> _values; // List is not Serializable
|
||||
}
|
||||
|
||||
/** The expression that identifies our row. */
|
||||
@@ -103,7 +104,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
/**
|
||||
* Constructs a new single-column {@code Key} with the given value.
|
||||
*/
|
||||
public Key (Class<T> pClass, String ix, Comparable val)
|
||||
public Key (Class<T> pClass, String ix, Comparable<?> val)
|
||||
{
|
||||
this(pClass, new String[] { ix }, new Comparable[] { val });
|
||||
}
|
||||
@@ -111,8 +112,8 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
/**
|
||||
* Constructs a new two-column {@code Key} with the given values.
|
||||
*/
|
||||
public Key (Class<T> pClass, String ix1, Comparable val1,
|
||||
String ix2, Comparable val2)
|
||||
public Key (Class<T> pClass, String ix1, Comparable<?> val1,
|
||||
String ix2, Comparable<?> val2)
|
||||
{
|
||||
this(pClass, new String[] { ix1, ix2 }, new Comparable[] { val1, val2 });
|
||||
}
|
||||
@@ -120,8 +121,8 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
/**
|
||||
* Constructs a new three-column {@code Key} with the given values.
|
||||
*/
|
||||
public Key (Class<T> pClass, String ix1, Comparable val1,
|
||||
String ix2, Comparable val2, String ix3, Comparable val3)
|
||||
public Key (Class<T> pClass, String ix1, Comparable<?> val1,
|
||||
String ix2, Comparable<?> val2, String ix3, Comparable<?> val3)
|
||||
{
|
||||
this(pClass, new String[] { ix1, ix2, ix3 }, new Comparable[] { val1, val2, val3 });
|
||||
}
|
||||
@@ -129,14 +130,14 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
/**
|
||||
* Constructs a new multi-column {@code Key} with the given values.
|
||||
*/
|
||||
public Key (Class<T> pClass, String[] fields, Comparable[] values)
|
||||
public Key (Class<T> pClass, String[] fields, Comparable<?>[] values)
|
||||
{
|
||||
if (fields.length != values.length) {
|
||||
throw new IllegalArgumentException("Field and Value arrays must be of equal length.");
|
||||
}
|
||||
|
||||
// build a local map of field name -> field value
|
||||
Map<String, Comparable> map = new HashMap<String, Comparable>();
|
||||
Map<String, Comparable<?>> map = new HashMap<String, Comparable<?>>();
|
||||
for (int i = 0; i < fields.length; i ++) {
|
||||
map.put(fields[i], values[i]);
|
||||
}
|
||||
@@ -145,9 +146,9 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
String[] keyFields = getKeyFields(pClass);
|
||||
|
||||
// now extract the values in field order and ensure none are extra or missing
|
||||
ArrayList<Comparable> newValues = new ArrayList<Comparable>();
|
||||
ArrayList<Comparable<?>> newValues = new ArrayList<Comparable<?>>();
|
||||
for (int ii = 0; ii < keyFields.length; ii++) {
|
||||
Comparable nugget = map.remove(keyFields[ii]);
|
||||
Comparable<?> nugget = map.remove(keyFields[ii]);
|
||||
if (nugget == null) {
|
||||
// make sure we were provided with a value for this primary key field
|
||||
throw new IllegalArgumentException("Missing value for key field: " + keyFields[ii]);
|
||||
@@ -227,7 +228,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
return condition.equals(((Key) obj).condition);
|
||||
return condition.equals(((Key<?>) obj).condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -260,7 +261,7 @@ public class Key<T extends PersistentRecord> extends WhereClause
|
||||
{
|
||||
String[] fields = _keyFields.get(pClass);
|
||||
if (fields == null) {
|
||||
ArrayList<String> kflist = new ArrayList<String>();
|
||||
List<String> kflist = new ArrayList<String>();
|
||||
for (Field field : pClass.getFields()) {
|
||||
// look for @Id fields
|
||||
if (field.getAnnotation(Id.class) != null) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class MultiKey<T extends PersistentRecord> extends WhereClause
|
||||
/**
|
||||
* Constructs a new single-column {@code MultiKey} with the given value range.
|
||||
*/
|
||||
public MultiKey (Class<T> pClass, String ix, Comparable... val)
|
||||
public MultiKey (Class<T> pClass, String ix, Comparable<?>... val)
|
||||
{
|
||||
this(pClass, new String[0], new Comparable[0], ix, val);
|
||||
}
|
||||
@@ -46,7 +46,8 @@ public class MultiKey<T extends PersistentRecord> extends WhereClause
|
||||
/**
|
||||
* Constructs a new two-column {@code MultiKey} with the given value range.
|
||||
*/
|
||||
public MultiKey (Class<T> pClass, String ix1, Comparable val1, String ix2, Comparable... val2)
|
||||
public MultiKey (Class<T> pClass, String ix1, Comparable<?> val1, String ix2,
|
||||
Comparable<?>... val2)
|
||||
{
|
||||
this(pClass, new String[] { ix1 }, new Comparable[] { val1 }, ix2, val2);
|
||||
}
|
||||
@@ -54,8 +55,8 @@ public class MultiKey<T extends PersistentRecord> extends WhereClause
|
||||
/**
|
||||
* Constructs a new three-column {@code MultiKey} with the given value range.
|
||||
*/
|
||||
public MultiKey (Class<T> pClass, String ix1, Comparable val1, String ix2, Comparable val2,
|
||||
String ix3, Comparable... val3)
|
||||
public MultiKey (Class<T> pClass, String ix1, Comparable<?> val1,
|
||||
String ix2, Comparable<?> val2, String ix3, Comparable<?>... val3)
|
||||
{
|
||||
this(pClass, new String[] { ix1, ix2 }, new Comparable[] { val1, val2 }, ix3, val3);
|
||||
}
|
||||
@@ -64,8 +65,8 @@ public class MultiKey<T extends PersistentRecord> extends WhereClause
|
||||
* Constructs a new multi-column {@code MultiKey} with the given value range.
|
||||
* @TODO: See {@link Key#Key(Class, String[], Comparable[]) for somewhat relevant comments.
|
||||
*/
|
||||
public MultiKey (Class<T> pClass, String[] sFields, Comparable[] sValues,
|
||||
String mField, Comparable[] mValues)
|
||||
public MultiKey (Class<T> pClass, String[] sFields, Comparable<?>[] sValues,
|
||||
String mField, Comparable<?>[] mValues)
|
||||
{
|
||||
if (sFields.length != sValues.length) {
|
||||
throw new IllegalArgumentException(
|
||||
@@ -74,7 +75,7 @@ public class MultiKey<T extends PersistentRecord> extends WhereClause
|
||||
_pClass = pClass;
|
||||
_mField = mField;
|
||||
_mValues = mValues;
|
||||
_map = new HashMap<String, Comparable>();
|
||||
_map = new HashMap<String, Comparable<?>>();
|
||||
for (int i = 0; i < sFields.length; i ++) {
|
||||
_map.put(sFields[i], sValues[i]);
|
||||
}
|
||||
@@ -85,7 +86,7 @@ public class MultiKey<T extends PersistentRecord> extends WhereClause
|
||||
return _pClass;
|
||||
}
|
||||
|
||||
public Map<String, Comparable> getSingleFieldsMap ()
|
||||
public Map<String, Comparable<?>> getSingleFieldsMap ()
|
||||
{
|
||||
return _map;
|
||||
}
|
||||
@@ -95,7 +96,7 @@ public class MultiKey<T extends PersistentRecord> extends WhereClause
|
||||
return _mField;
|
||||
}
|
||||
|
||||
public Comparable[] getMultiValues ()
|
||||
public Comparable<?>[] getMultiValues ()
|
||||
{
|
||||
return _mValues;
|
||||
}
|
||||
@@ -126,7 +127,7 @@ public class MultiKey<T extends PersistentRecord> extends WhereClause
|
||||
// from CacheInvalidator
|
||||
public void invalidate (PersistenceContext ctx)
|
||||
{
|
||||
HashMap<String, Comparable> newMap = new HashMap<String, Comparable>(_map);
|
||||
HashMap<String, Comparable<?>> newMap = new HashMap<String, Comparable<?>>(_map);
|
||||
for (int i = 0; i < _mValues.length; i ++) {
|
||||
newMap.put(_mField, _mValues[i]);
|
||||
ctx.cacheInvalidate(new SimpleCacheKey(_pClass, newMap));
|
||||
@@ -141,7 +142,7 @@ public class MultiKey<T extends PersistentRecord> extends WhereClause
|
||||
}
|
||||
|
||||
protected String _mField;
|
||||
protected Comparable[] _mValues;
|
||||
protected Comparable<?>[] _mValues;
|
||||
protected Class<T> _pClass;
|
||||
protected HashMap<String, Comparable> _map;
|
||||
protected HashMap<String, Comparable<?>> _map;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public class MySQLBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T> String getColumnType (FieldMarshaller fm, int length)
|
||||
protected <T> String getColumnType (FieldMarshaller<?> fm, int length)
|
||||
{
|
||||
if (fm instanceof ByteMarshaller) {
|
||||
return "TINYINT";
|
||||
|
||||
@@ -316,9 +316,8 @@ public class PersistenceContext
|
||||
log.debug("storing [key=" + key + ", value=" + entry + "]");
|
||||
|
||||
CacheAdapter.CacheBin<T> bin = _cache.getCache(key.getCacheId());
|
||||
CacheAdapter.CachedValue element = bin.lookup(key.getCacheKey());
|
||||
@SuppressWarnings("unchecked") T oldEntry =
|
||||
(element != null ? (T) element.getValue() : null);
|
||||
CacheAdapter.CachedValue<T> element = bin.lookup(key.getCacheKey());
|
||||
T oldEntry = (element != null ? element.getValue() : null);
|
||||
|
||||
// update the cache
|
||||
bin.store(key.getCacheKey(), entry);
|
||||
@@ -353,7 +352,7 @@ public class PersistenceContext
|
||||
* Evicts the cache entry indexed under the given class and cache key, if there is one. The
|
||||
* eviction may trigger further cache invalidations.
|
||||
*/
|
||||
public void cacheInvalidate (Class pClass, Serializable cacheKey)
|
||||
public void cacheInvalidate (Class<? extends PersistentRecord> pClass, Serializable cacheKey)
|
||||
{
|
||||
cacheInvalidate(pClass.getName(), cacheKey);
|
||||
}
|
||||
@@ -397,7 +396,8 @@ public class PersistenceContext
|
||||
* Brutally iterates over the entire contents of the cache associated with the given class,
|
||||
* invoking the callback for each cache entry.
|
||||
*/
|
||||
public <T extends Serializable> void cacheTraverse (Class pClass, CacheTraverser<T> filter)
|
||||
public <T extends Serializable> void cacheTraverse (
|
||||
Class<? extends PersistentRecord> pClass, CacheTraverser<T> filter)
|
||||
{
|
||||
cacheTraverse(pClass.getName(), filter);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public class PostgreSQLBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T> String getColumnType (FieldMarshaller fm, int length)
|
||||
protected <T> String getColumnType (FieldMarshaller<?> fm, int length)
|
||||
{
|
||||
if (fm instanceof ByteMarshaller) {
|
||||
return "SMALLINT";
|
||||
|
||||
@@ -109,7 +109,7 @@ public abstract class SQLBuilder
|
||||
* TODO: This method should be split into several parts that are more easily overridden on a
|
||||
* case-by-case basis in the dialectal subclasses.
|
||||
*/
|
||||
public ColumnDefinition buildColumnDefinition (FieldMarshaller fm)
|
||||
public ColumnDefinition buildColumnDefinition (FieldMarshaller<?> fm)
|
||||
{
|
||||
// if this field is @Computed, it has no SQL definition
|
||||
if (fm.getComputed() != null) {
|
||||
@@ -228,7 +228,7 @@ public abstract class SQLBuilder
|
||||
* Overridden by subclasses to figure the dialect-specific SQL type of the given field.
|
||||
* @param length
|
||||
*/
|
||||
protected abstract <T> String getColumnType (FieldMarshaller fm, int length);
|
||||
protected abstract <T> String getColumnType (FieldMarshaller<?> fm, int length);
|
||||
|
||||
/** The class that maps persistent classes to marshallers. */
|
||||
protected DepotTypes _types;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SimpleCacheKey
|
||||
* Construct a {@link SimpleCacheKey} associated with the given persistent class with
|
||||
* the given cache key.
|
||||
*/
|
||||
public SimpleCacheKey (Class cacheClass, Serializable cacheKey)
|
||||
public SimpleCacheKey (Class<?> cacheClass, Serializable cacheKey)
|
||||
{
|
||||
this(cacheClass.getName(), cacheKey);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ import com.samskivert.jdbc.JDBCUtil;
|
||||
*/
|
||||
public class TableValueGenerator extends ValueGenerator
|
||||
{
|
||||
public TableValueGenerator (TableGenerator tg, GeneratedValue gv, DepotMarshaller dm, FieldMarshaller fm)
|
||||
public TableValueGenerator (
|
||||
TableGenerator tg, GeneratedValue gv, DepotMarshaller<?> dm, FieldMarshaller<?> fm)
|
||||
{
|
||||
super(gv, dm, fm);
|
||||
_valueTable = defStr(tg.table(), "IdSequences");
|
||||
|
||||
@@ -36,7 +36,7 @@ import static com.samskivert.jdbc.depot.Log.log;
|
||||
*/
|
||||
public abstract class ValueGenerator
|
||||
{
|
||||
public ValueGenerator (GeneratedValue gv, DepotMarshaller dm, FieldMarshaller fm)
|
||||
public ValueGenerator (GeneratedValue gv, DepotMarshaller<?> dm, FieldMarshaller<?> fm)
|
||||
{
|
||||
_allocationSize = gv.allocationSize();
|
||||
_initialValue = gv.initialValue();
|
||||
@@ -101,12 +101,12 @@ public abstract class ValueGenerator
|
||||
}
|
||||
}
|
||||
|
||||
public DepotMarshaller getDepotMarshaller ()
|
||||
public DepotMarshaller<?> getDepotMarshaller ()
|
||||
{
|
||||
return _dm;
|
||||
}
|
||||
|
||||
public FieldMarshaller getFieldMarshaller ()
|
||||
public FieldMarshaller<?> getFieldMarshaller ()
|
||||
{
|
||||
return _fm;
|
||||
}
|
||||
@@ -115,6 +115,6 @@ public abstract class ValueGenerator
|
||||
protected int _allocationSize;
|
||||
protected boolean _migrateIfExists;
|
||||
|
||||
protected DepotMarshaller _dm;
|
||||
protected FieldMarshaller _fm;
|
||||
protected DepotMarshaller<?> _dm;
|
||||
protected FieldMarshaller<?> _fm;
|
||||
}
|
||||
|
||||
@@ -38,26 +38,26 @@ import com.samskivert.jdbc.depot.operator.Logic.And;
|
||||
*/
|
||||
public class Where extends WhereClause
|
||||
{
|
||||
public Where (ColumnExp column, Comparable value)
|
||||
public Where (ColumnExp column, Comparable<?> value)
|
||||
{
|
||||
this(new ColumnExp[] { column }, new Comparable[] { value });
|
||||
this(new ColumnExp[] { column }, new Comparable<?>[] { value });
|
||||
}
|
||||
|
||||
public Where (ColumnExp index1, Comparable value1,
|
||||
ColumnExp index2, Comparable value2)
|
||||
public Where (ColumnExp index1, Comparable<?> value1,
|
||||
ColumnExp index2, Comparable<?> value2)
|
||||
{
|
||||
this(new ColumnExp[] { index1, index2 }, new Comparable[] { value1, value2 });
|
||||
this(new ColumnExp[] { index1, index2 }, new Comparable<?>[] { value1, value2 });
|
||||
}
|
||||
|
||||
public Where (ColumnExp index1, Comparable value1,
|
||||
ColumnExp index2, Comparable value2,
|
||||
ColumnExp index3, Comparable value3)
|
||||
public Where (ColumnExp index1, Comparable<?> value1,
|
||||
ColumnExp index2, Comparable<?> value2,
|
||||
ColumnExp index3, Comparable<?> value3)
|
||||
{
|
||||
this(new ColumnExp[] { index1, index2, index3 },
|
||||
new Comparable[] { value1, value2, value3 });
|
||||
new Comparable<?>[] { value1, value2, value3 });
|
||||
}
|
||||
|
||||
public Where (ColumnExp[] columns, Comparable[] values)
|
||||
public Where (ColumnExp[] columns, Comparable<?>[] values)
|
||||
{
|
||||
this(toCondition(columns, values));
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class Where extends WhereClause
|
||||
_condition.addClasses(classSet);
|
||||
}
|
||||
|
||||
protected static SQLExpression toCondition (ColumnExp[] columns, Comparable[] values)
|
||||
protected static SQLExpression toCondition (ColumnExp[] columns, Comparable<?>[] values)
|
||||
{
|
||||
SQLExpression[] comparisons = new SQLExpression[columns.length];
|
||||
for (int ii = 0; ii < columns.length; ii ++) {
|
||||
|
||||
@@ -55,7 +55,7 @@ public interface ExpressionVisitor
|
||||
throws Exception;
|
||||
public void visit (WhereCondition<? extends PersistentRecord> whereCondition)
|
||||
throws Exception;
|
||||
public void visit (Key key)
|
||||
public void visit (Key<? extends PersistentRecord> key)
|
||||
throws Exception;
|
||||
public void visit (MultiKey<? extends PersistentRecord> key)
|
||||
throws Exception;
|
||||
|
||||
@@ -32,7 +32,7 @@ public abstract class Arithmetic
|
||||
/** The SQL '+' operator. */
|
||||
public static class Add extends BinaryOperator
|
||||
{
|
||||
public Add (SQLExpression column, Comparable value)
|
||||
public Add (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public abstract class Arithmetic
|
||||
/** The SQL '-' operator. */
|
||||
public static class Sub extends BinaryOperator
|
||||
{
|
||||
public Sub (SQLExpression column, Comparable value)
|
||||
public Sub (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public abstract class Arithmetic
|
||||
/** The SQL '*' operator. */
|
||||
public static class Mul extends BinaryOperator
|
||||
{
|
||||
public Mul (SQLExpression column, Comparable value)
|
||||
public Mul (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public abstract class Arithmetic
|
||||
/** The SQL '/' operator. */
|
||||
public static class Div extends BinaryOperator
|
||||
{
|
||||
public Div (SQLExpression column, Comparable value)
|
||||
public Div (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public abstract class Arithmetic
|
||||
/** The SQL '&' operator. */
|
||||
public static class BitAnd extends BinaryOperator
|
||||
{
|
||||
public BitAnd (SQLExpression column, Comparable value)
|
||||
public BitAnd (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public abstract class Arithmetic
|
||||
/** The SQL '|' operator. */
|
||||
public static class BitOr extends BinaryOperator
|
||||
{
|
||||
public BitOr (SQLExpression column, Comparable value)
|
||||
public BitOr (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class Conditionals
|
||||
/** The SQL '=' operator. */
|
||||
public static class Equals extends SQLOperator.BinaryOperator
|
||||
{
|
||||
public Equals (SQLExpression column, Comparable value)
|
||||
public Equals (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public abstract class Conditionals
|
||||
/** The SQL '!=' operator. */
|
||||
public static class NotEquals extends SQLOperator.BinaryOperator
|
||||
{
|
||||
public NotEquals (SQLExpression column, Comparable value)
|
||||
public NotEquals (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public abstract class Conditionals
|
||||
/** The SQL '<' operator. */
|
||||
public static class LessThan extends SQLOperator.BinaryOperator
|
||||
{
|
||||
public LessThan (SQLExpression column, Comparable value)
|
||||
public LessThan (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public abstract class Conditionals
|
||||
/** The SQL '<=' operator. */
|
||||
public static class LessThanEquals extends SQLOperator.BinaryOperator
|
||||
{
|
||||
public LessThanEquals (SQLExpression column, Comparable value)
|
||||
public LessThanEquals (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public abstract class Conditionals
|
||||
/** The SQL '>' operator. */
|
||||
public static class GreaterThan extends SQLOperator.BinaryOperator
|
||||
{
|
||||
public GreaterThan (SQLExpression column, Comparable value)
|
||||
public GreaterThan (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public abstract class Conditionals
|
||||
/** The SQL '>=' operator. */
|
||||
public static class GreaterThanEquals extends SQLOperator.BinaryOperator
|
||||
{
|
||||
public GreaterThanEquals (SQLExpression column, Comparable value)
|
||||
public GreaterThanEquals (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
@@ -196,18 +196,18 @@ public abstract class Conditionals
|
||||
public static class In
|
||||
implements SQLOperator
|
||||
{
|
||||
public In (Class<? extends PersistentRecord> pClass, String pColumn, Comparable... values)
|
||||
public In (Class<? extends PersistentRecord> pClass, String pColumn, Comparable<?>... values)
|
||||
{
|
||||
this(new ColumnExp(pClass, pColumn), values);
|
||||
}
|
||||
|
||||
public In (Class<? extends PersistentRecord> pClass, String pColumn,
|
||||
Collection<? extends Comparable> values)
|
||||
Collection<? extends Comparable<?>> values)
|
||||
{
|
||||
this(new ColumnExp(pClass, pColumn), values.toArray(new Comparable[values.size()]));
|
||||
this(new ColumnExp(pClass, pColumn), values.toArray(new Comparable<?>[values.size()]));
|
||||
}
|
||||
|
||||
public In (ColumnExp column, Comparable... values)
|
||||
public In (ColumnExp column, Comparable<?>... values)
|
||||
{
|
||||
if (values.length == 0) {
|
||||
throw new IllegalArgumentException("In() condition needs at least one value.");
|
||||
@@ -216,9 +216,9 @@ public abstract class Conditionals
|
||||
_values = values;
|
||||
}
|
||||
|
||||
public In (ColumnExp pColumn, Collection<? extends Comparable> values)
|
||||
public In (ColumnExp pColumn, Collection<? extends Comparable<?>> values)
|
||||
{
|
||||
this(pColumn, values.toArray(new Comparable[values.size()]));
|
||||
this(pColumn, values.toArray(new Comparable<?>[values.size()]));
|
||||
}
|
||||
|
||||
public ColumnExp getColumn ()
|
||||
@@ -226,7 +226,7 @@ public abstract class Conditionals
|
||||
return _column;
|
||||
}
|
||||
|
||||
public Comparable[] getValues ()
|
||||
public Comparable<?>[] getValues ()
|
||||
{
|
||||
return _values;
|
||||
}
|
||||
@@ -244,13 +244,13 @@ public abstract class Conditionals
|
||||
}
|
||||
|
||||
protected ColumnExp _column;
|
||||
protected Comparable[] _values;
|
||||
protected Comparable<?>[] _values;
|
||||
}
|
||||
|
||||
/** The SQL ' like ' operator. */
|
||||
public static class Like extends SQLOperator.BinaryOperator
|
||||
{
|
||||
public Like (SQLExpression column, Comparable value)
|
||||
public Like (SQLExpression column, Comparable<?> value)
|
||||
{
|
||||
super(column, value);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public interface SQLOperator extends SQLExpression
|
||||
_rhs = rhs;
|
||||
}
|
||||
|
||||
public BinaryOperator (SQLExpression lhs, Comparable rhs)
|
||||
public BinaryOperator (SQLExpression lhs, Comparable<?> rhs)
|
||||
{
|
||||
this(lhs, new ValueExp(rhs));
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class GenRecordTask extends Task
|
||||
}
|
||||
|
||||
/** Processes a resolved persistent record class instance. */
|
||||
protected void processRecord (File source, Class rclass)
|
||||
protected void processRecord (File source, Class<?> rclass)
|
||||
{
|
||||
// make sure we extend persistent record
|
||||
if (!_prclass.isAssignableFrom(rclass)) {
|
||||
|
||||
@@ -391,7 +391,7 @@ class FieldDescriptor
|
||||
protected String name; // full (compound) name of component
|
||||
protected Field field; // field info from java.lang.reflect
|
||||
|
||||
protected Constructor constructor; // constructor of object component
|
||||
protected Constructor<?> constructor; // constructor of object component
|
||||
|
||||
protected static final int t_byte = 0;
|
||||
protected static final int t_short = 1;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class FieldMask
|
||||
* Returns true only if the set of modified fields is a subset of the
|
||||
* fields specified.
|
||||
*/
|
||||
public final boolean onlySubsetModified (Set fieldSet)
|
||||
public final boolean onlySubsetModified (Set<String> fieldSet)
|
||||
{
|
||||
for (String field : _descripMap.keySet()) {
|
||||
if (isModified(field) && (!fieldSet.contains(field))) {
|
||||
|
||||
@@ -486,11 +486,11 @@ public class Table<T>
|
||||
}
|
||||
|
||||
protected final int buildFieldsList (ArrayList<FieldDescriptor> buf,
|
||||
Class _rowClass, String prefix)
|
||||
Class<?> _rowClass, String prefix)
|
||||
{
|
||||
Field[] f = _rowClass.getDeclaredFields();
|
||||
|
||||
Class superclass = _rowClass;
|
||||
Class<?> superclass = _rowClass;
|
||||
while ((superclass = superclass.getSuperclass()) != null) {
|
||||
Field[] inheritedFields = superclass.getDeclaredFields();
|
||||
Field[] allFields = new Field[inheritedFields.length + f.length];
|
||||
@@ -908,10 +908,11 @@ public class Table<T>
|
||||
|
||||
static {
|
||||
try {
|
||||
serializableClass = Serializable.class;
|
||||
Class<?> c = Class.forName("java.lang.reflect.AccessibleObject");
|
||||
Class[] param = { Boolean.TYPE };
|
||||
setBypass = c.getMethod("setAccessible", param);
|
||||
} catch(Exception ex) {}
|
||||
serializableClass = Serializable.class;
|
||||
Class<?> c = Class.forName("java.lang.reflect.AccessibleObject");
|
||||
setBypass = c.getMethod("setAccessible", new Class<?>[] { Boolean.TYPE });
|
||||
} catch(Exception ex) {
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ public class MessageManager
|
||||
ResourceBundle bundle = null;
|
||||
|
||||
if (req != null) {
|
||||
Enumeration locales = req.getLocales();
|
||||
Enumeration<?> locales = req.getLocales();
|
||||
while (locales.hasMoreElements()) {
|
||||
Locale locale = (Locale)locales.nextElement();
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ExceptionMap
|
||||
if (_keys != null) {
|
||||
return;
|
||||
} else {
|
||||
_keys = new ArrayList<Class>();
|
||||
_keys = new ArrayList<Class<?>>();
|
||||
_values = new ArrayList<String>();
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class ExceptionMap
|
||||
for (int i = 0; i < classes.size(); i++) {
|
||||
String exclass = classes.get(i);
|
||||
try {
|
||||
Class cl = Class.forName(exclass);
|
||||
Class<?> cl = Class.forName(exclass);
|
||||
// replace the string with the class object
|
||||
_keys.add(cl);
|
||||
|
||||
@@ -146,7 +146,7 @@ public class ExceptionMap
|
||||
{
|
||||
String msg = DEFAULT_ERROR_MSG;
|
||||
for (int i = 0; i < _keys.size(); i++) {
|
||||
Class cl = _keys.get(i);
|
||||
Class<?> cl = _keys.get(i);
|
||||
if (cl.isInstance(ex)) {
|
||||
msg = _values.get(i);
|
||||
break;
|
||||
@@ -155,7 +155,7 @@ public class ExceptionMap
|
||||
return StringUtil.replace(msg, MESSAGE_MARKER, ex.getMessage());
|
||||
}
|
||||
|
||||
protected static List<Class> _keys;
|
||||
protected static List<Class<?>> _keys;
|
||||
protected static List<String> _values;
|
||||
|
||||
// initialize ourselves
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
package com.samskivert.servlet.util;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -109,13 +108,15 @@ public class RequestUtils
|
||||
public static String reconstructURL (HttpServletRequest req)
|
||||
{
|
||||
StringBuffer buf = req.getRequestURL();
|
||||
Map map = req.getParameterMap();
|
||||
@SuppressWarnings("unchecked") Map<String, String[]> map = req.getParameterMap();
|
||||
if (map.size() > 0) {
|
||||
buf.append("?");
|
||||
for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
for (Map.Entry<String, String[]> entry : map.entrySet()) {
|
||||
if (buf.charAt(buf.length()-1) != '?') {
|
||||
buf.append("&");
|
||||
}
|
||||
buf.append(entry.getKey()).append("=");
|
||||
String[] values = (String[])entry.getValue();
|
||||
String[] values = entry.getValue();
|
||||
if (values.length == 1) {
|
||||
buf.append(values[0]);
|
||||
} else {
|
||||
@@ -128,9 +129,6 @@ public class RequestUtils
|
||||
}
|
||||
buf.append(")");
|
||||
}
|
||||
if (iter.hasNext()) {
|
||||
buf.append("&");
|
||||
}
|
||||
}
|
||||
}
|
||||
return buf.toString();
|
||||
|
||||
@@ -356,7 +356,7 @@ public abstract class Controller
|
||||
Method method, Object source, Object argument)
|
||||
{
|
||||
// figure out what sort of arguments are required by the method
|
||||
Class[] atypes = method.getParameterTypes();
|
||||
Class<?>[] atypes = method.getParameterTypes();
|
||||
|
||||
if (atypes == null || atypes.length == 0) {
|
||||
return new Object[0];
|
||||
|
||||
@@ -72,9 +72,9 @@ public class ObjectEditorTable extends JTable
|
||||
* the field is used, or its object equivalent if it is a primitive
|
||||
* class.
|
||||
*/
|
||||
public Class getClass (Field field)
|
||||
public Class<?> getClass (Field field)
|
||||
{
|
||||
Class clazz = field.getType();
|
||||
Class<?> clazz = field.getType();
|
||||
return ClassUtil.objectEquivalentOf(clazz);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ObjectEditorTable extends JTable
|
||||
*
|
||||
* @param protoClass the Class of the data that will be displayed.
|
||||
*/
|
||||
public ObjectEditorTable (Class protoClass)
|
||||
public ObjectEditorTable (Class<?> protoClass)
|
||||
{
|
||||
this(protoClass, null);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class ObjectEditorTable extends JTable
|
||||
* @param protoClass the Class of the data that will be displayed.
|
||||
* @param editableFields the names of the fields that are editable.
|
||||
*/
|
||||
public ObjectEditorTable (Class protoClass, String[] editableFields)
|
||||
public ObjectEditorTable (Class<?> protoClass, String[] editableFields)
|
||||
{
|
||||
this(protoClass, editableFields, null);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public class ObjectEditorTable extends JTable
|
||||
* @param editableFields the names of the fields that are editable.
|
||||
* @param interp The {@link FieldInterpreter} to use.
|
||||
*/
|
||||
public ObjectEditorTable (Class protoClass, String[] editableFields,
|
||||
public ObjectEditorTable (Class<?> protoClass, String[] editableFields,
|
||||
FieldInterpreter interp)
|
||||
{
|
||||
this(protoClass, editableFields, interp, null);
|
||||
@@ -148,7 +148,7 @@ public class ObjectEditorTable extends JTable
|
||||
* @param interp The {@link FieldInterpreter} to use.
|
||||
* @param displayFields the fields to display, or null to display all.
|
||||
*/
|
||||
public ObjectEditorTable (Class protoClass, String[] editableFields,
|
||||
public ObjectEditorTable (Class<?> protoClass, String[] editableFields,
|
||||
FieldInterpreter interp, String[] displayFields)
|
||||
{
|
||||
_interp = (interp != null) ? interp : new FieldInterpreter();
|
||||
|
||||
@@ -193,13 +193,13 @@ public class TGraphics2D extends Graphics2D
|
||||
return _primary.getRenderingHint(k);
|
||||
}
|
||||
|
||||
public void setRenderingHints (Map m)
|
||||
public void setRenderingHints (Map<?, ?> m)
|
||||
{
|
||||
_copy.setRenderingHints(m);
|
||||
_primary.setRenderingHints(m);
|
||||
}
|
||||
|
||||
public void addRenderingHints (Map m)
|
||||
public void addRenderingHints (Map<?, ?> m)
|
||||
{
|
||||
_copy.addRenderingHints(m);
|
||||
_primary.addRenderingHints(m);
|
||||
@@ -553,7 +553,7 @@ public class TGraphics2D extends Graphics2D
|
||||
return _primary.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public Rectangle getClipRect ()
|
||||
{
|
||||
// getClipRect is deprecated, but getClipBounds is the new way to do the same thing. We
|
||||
|
||||
@@ -108,8 +108,8 @@ public class TableSorter extends AbstractTableModel {
|
||||
private JTableHeader tableHeader;
|
||||
private MouseListener mouseListener;
|
||||
private TableModelListener tableModelListener;
|
||||
private Map<Class,Comparator<Object>> columnComparators =
|
||||
new HashMap<Class,Comparator<Object>>();
|
||||
private Map<Class<?>,Comparator<Object>> columnComparators =
|
||||
new HashMap<Class<?>,Comparator<Object>>();
|
||||
private List<Directive> sortingColumns = new ArrayList<Directive>();
|
||||
|
||||
public TableSorter() {
|
||||
@@ -221,7 +221,7 @@ public class TableSorter extends AbstractTableModel {
|
||||
sortingStatusChanged();
|
||||
}
|
||||
|
||||
public void setColumnComparator(Class type, Comparator<Object> comparator) {
|
||||
public void setColumnComparator(Class<?> type, Comparator<Object> comparator) {
|
||||
if (comparator == null) {
|
||||
columnComparators.remove(type);
|
||||
} else {
|
||||
@@ -230,7 +230,7 @@ public class TableSorter extends AbstractTableModel {
|
||||
}
|
||||
|
||||
protected Comparator<Object> getComparator(int column) {
|
||||
Class columnType = tableModel.getColumnClass(column);
|
||||
Class<?> columnType = tableModel.getColumnClass(column);
|
||||
Comparator<Object> comparator = columnComparators.get(columnType);
|
||||
if (comparator != null) {
|
||||
return comparator;
|
||||
|
||||
@@ -253,6 +253,5 @@ public class MenuUtil
|
||||
}
|
||||
|
||||
/** The method signature for menu callback methods. */
|
||||
protected static final Class[] METHOD_ARGS =
|
||||
new Class[] { ActionEvent.class };
|
||||
protected static final Class<?>[] METHOD_ARGS = new Class<?>[] { ActionEvent.class };
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class SwingUtil
|
||||
* be left at it's original location.
|
||||
*/
|
||||
public static boolean positionRect (
|
||||
Rectangle r, Rectangle bounds, Collection avoidShapes)
|
||||
Rectangle r, Rectangle bounds, Collection<? extends Shape> avoidShapes)
|
||||
{
|
||||
Point origPos = r.getLocation();
|
||||
Comparator<Point> comp = createPointComparator(origPos);
|
||||
@@ -182,8 +182,8 @@ public class SwingUtil
|
||||
}
|
||||
|
||||
// see if it hits any shapes we're trying to avoid
|
||||
for (Iterator iter=avoidShapes.iterator(); iter.hasNext(); ) {
|
||||
Shape shape = (Shape) iter.next();
|
||||
for (Iterator<? extends Shape> iter = avoidShapes.iterator(); iter.hasNext(); ) {
|
||||
Shape shape = iter.next();
|
||||
|
||||
if (shape.intersects(r)) {
|
||||
// remove that shape from our avoid list
|
||||
|
||||
@@ -295,7 +295,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public boolean containsAll (Collection c)
|
||||
public boolean containsAll (Collection<?> c)
|
||||
{
|
||||
if (c instanceof Interable) {
|
||||
Interator inter = ((Interable) c).interator();
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ClassUtil
|
||||
* @return true if the class is accessible, false otherwise. Presently returns true if the
|
||||
* class is declared public.
|
||||
*/
|
||||
public static boolean classIsAccessible (Class clazz)
|
||||
public static boolean classIsAccessible (Class<?> clazz)
|
||||
{
|
||||
return Modifier.isPublic(clazz.getModifiers());
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class ClassUtil
|
||||
/**
|
||||
* Get the fields contained in the class and its superclasses.
|
||||
*/
|
||||
public static Field[] getFields (Class clazz)
|
||||
public static Field[] getFields (Class<?> clazz)
|
||||
{
|
||||
ArrayList<Field> list = new ArrayList<Field>();
|
||||
getFields(clazz, list);
|
||||
@@ -60,10 +60,10 @@ public class ClassUtil
|
||||
* Add all the fields of the specifed class (and its ancestors) to the list. Note, if we are
|
||||
* running in a sandbox, this will only enumerate public members.
|
||||
*/
|
||||
public static void getFields (Class clazz, List<Field> addTo)
|
||||
public static void getFields (Class<?> clazz, List<Field> addTo)
|
||||
{
|
||||
// first get the fields of the superclass
|
||||
Class pclazz = clazz.getSuperclass();
|
||||
Class<?> pclazz = clazz.getSuperclass();
|
||||
if (pclazz != null && !pclazz.equals(Object.class)) {
|
||||
getFields(pclazz, addTo);
|
||||
}
|
||||
@@ -100,16 +100,16 @@ public class ClassUtil
|
||||
* Object array. If args is null, a zero-length Class array is returned. If an element in
|
||||
* args is null, then Void.TYPE is the corresponding Class in the return array.
|
||||
*/
|
||||
public static Class[] getParameterTypesFrom (Object[] args)
|
||||
public static Class<?>[] getParameterTypesFrom (Object[] args)
|
||||
{
|
||||
Class[] argTypes = null;
|
||||
Class<?>[] argTypes = null;
|
||||
if (args != null) {
|
||||
argTypes = new Class[args.length];
|
||||
for (int i = 0; i < args.length; ++i) {
|
||||
argTypes[i] = (args[i] == null) ? Void.TYPE : args[i].getClass();
|
||||
}
|
||||
} else {
|
||||
argTypes = new Class[0];
|
||||
argTypes = new Class<?>[0];
|
||||
}
|
||||
return argTypes;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public class ClassUtil
|
||||
* @return the nearest method located, or null if there is no such method.
|
||||
*/
|
||||
public static Method getAccessibleMethodFrom (
|
||||
Class<?> clazz, String methodName, Class[] parameterTypes)
|
||||
Class<?> clazz, String methodName, Class<?>[] parameterTypes)
|
||||
{
|
||||
// Look for overridden method in the superclass.
|
||||
Class<?> superclass = clazz.getSuperclass();
|
||||
@@ -229,7 +229,7 @@ public class ClassUtil
|
||||
* @return the class's primitive equivalent, if clazz is a primitive wrapper. If clazz is
|
||||
* primitive, returns clazz. Otherwise, returns null.
|
||||
*/
|
||||
public static Class<?> primitiveEquivalentOf (Class clazz)
|
||||
public static Class<?> primitiveEquivalentOf (Class<?> clazz)
|
||||
{
|
||||
return clazz.isPrimitive() ? clazz : _objectToPrimitiveMap.get(clazz);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public class ClassUtil
|
||||
/**
|
||||
* @return the class's object equivalent if the class is a primitive type.
|
||||
*/
|
||||
public static Class<?> objectEquivalentOf (Class clazz)
|
||||
public static Class<?> objectEquivalentOf (Class<?> clazz)
|
||||
{
|
||||
return clazz.isPrimitive() ? _primitiveToObjectMap.get(clazz) : clazz;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ public class ClassUtil
|
||||
* @return true if compatible, false otherwise. If either argument is <code>null</code>, or one
|
||||
* of the parameters does not represent a primitive (e.g. Byte.TYPE), returns false.
|
||||
*/
|
||||
public static boolean primitiveIsAssignableFrom (Class lhs, Class rhs)
|
||||
public static boolean primitiveIsAssignableFrom (Class<?> lhs, Class<?> rhs)
|
||||
{
|
||||
if (lhs == null || rhs == null) {
|
||||
return false;
|
||||
@@ -263,7 +263,7 @@ public class ClassUtil
|
||||
if (lhs.equals(rhs)) {
|
||||
return true;
|
||||
}
|
||||
Set<Class> wideningSet = _primitiveWideningsMap.get(rhs);
|
||||
Set<Class<?>> wideningSet = _primitiveWideningsMap.get(rhs);
|
||||
if (wideningSet == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -298,11 +298,11 @@ public class ClassUtil
|
||||
|
||||
/** Mapping from primitive wrapper Classes to the sets of primitive classes whose instances can
|
||||
* be assigned an instance of the first. */
|
||||
protected static final Map<Class,Set<Class>> _primitiveWideningsMap =
|
||||
new HashMap<Class,Set<Class>>(11);
|
||||
protected static final Map<Class<?>,Set<Class<?>>> _primitiveWideningsMap =
|
||||
new HashMap<Class<?>,Set<Class<?>>>(11);
|
||||
|
||||
static {
|
||||
Set<Class> set = new HashSet<Class>();
|
||||
Set<Class<?>> set = new HashSet<Class<?>>();
|
||||
set.add(Short.TYPE);
|
||||
set.add(Integer.TYPE);
|
||||
set.add(Long.TYPE);
|
||||
@@ -310,7 +310,7 @@ public class ClassUtil
|
||||
set.add(Double.TYPE);
|
||||
_primitiveWideningsMap.put(Byte.TYPE, set);
|
||||
|
||||
set = new HashSet<Class>();
|
||||
set = new HashSet<Class<?>>();
|
||||
set.add(Integer.TYPE);
|
||||
set.add(Long.TYPE);
|
||||
set.add(Float.TYPE);
|
||||
@@ -318,18 +318,18 @@ public class ClassUtil
|
||||
_primitiveWideningsMap.put(Short.TYPE, set);
|
||||
_primitiveWideningsMap.put(Character.TYPE, set);
|
||||
|
||||
set = new HashSet<Class>();
|
||||
set = new HashSet<Class<?>>();
|
||||
set.add(Long.TYPE);
|
||||
set.add(Float.TYPE);
|
||||
set.add(Double.TYPE);
|
||||
_primitiveWideningsMap.put(Integer.TYPE, set);
|
||||
|
||||
set = new HashSet<Class>();
|
||||
set = new HashSet<Class<?>>();
|
||||
set.add(Float.TYPE);
|
||||
set.add(Double.TYPE);
|
||||
_primitiveWideningsMap.put(Long.TYPE, set);
|
||||
|
||||
set = new HashSet<Class>();
|
||||
set = new HashSet<Class<?>>();
|
||||
set.add(Double.TYPE);
|
||||
_primitiveWideningsMap.put(Float.TYPE, set);
|
||||
}
|
||||
|
||||
@@ -390,9 +390,8 @@ public class Config
|
||||
}
|
||||
|
||||
// build the sub-properties
|
||||
Iterator iter = keys();
|
||||
while (iter.hasNext()) {
|
||||
String key = (String)iter.next();
|
||||
for (Iterator<String> iter = keys(); iter.hasNext(); ) {
|
||||
String key = iter.next();
|
||||
if (!key.startsWith(prefix)) {
|
||||
continue;
|
||||
}
|
||||
@@ -416,7 +415,7 @@ public class Config
|
||||
|
||||
protected void enumerateKeys (HashSet<String> keys)
|
||||
{
|
||||
Enumeration defkeys = _props.propertyNames();
|
||||
Enumeration<?> defkeys = _props.propertyNames();
|
||||
while (defkeys.hasMoreElements()) {
|
||||
keys.add((String)defkeys.nextElement());
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -81,7 +81,7 @@ public class FileUtil
|
||||
public static boolean unpackJar (JarFile jar, File target)
|
||||
{
|
||||
boolean failure = false;
|
||||
Enumeration entries = jar.entries();
|
||||
Enumeration<?> entries = jar.entries();
|
||||
while (!failure && entries.hasMoreElements()) {
|
||||
JarEntry entry = (JarEntry)entries.nextElement();
|
||||
File efile = new File(target, entry.getName());
|
||||
|
||||
@@ -48,7 +48,7 @@ public class GenUtil
|
||||
if (type instanceof GenericArrayType) {
|
||||
return simpleName(((GenericArrayType)type).getGenericComponentType()) + "[]";
|
||||
} else if (type instanceof Class) {
|
||||
Class clazz = (Class)type;
|
||||
Class<?> clazz = (Class<?>)type;
|
||||
if (clazz.isArray()) {
|
||||
return simpleName(clazz.getComponentType()) + "[]";
|
||||
} else {
|
||||
|
||||
@@ -538,8 +538,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
|
||||
|
||||
protected Record<V>[] createBuckets (int size)
|
||||
{
|
||||
@SuppressWarnings("unchecked") Record<V>[] recs =
|
||||
(Record<V>[]) new Record[size];
|
||||
@SuppressWarnings("unchecked") Record<V>[] recs = new Record[size];
|
||||
return recs;
|
||||
}
|
||||
|
||||
@@ -582,7 +581,7 @@ public class HashIntMap<V> extends AbstractMap<Integer,V>
|
||||
if (!(o instanceof IntEntry)) {
|
||||
return false;
|
||||
}
|
||||
IntEntry that = (IntEntry)o;
|
||||
IntEntry<?> that = (IntEntry<?>)o;
|
||||
return (this.key == that.getIntKey()) &&
|
||||
ObjectUtil.equals(this.value, that.getValue());
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class JDK14Logger implements Logger.Factory
|
||||
}
|
||||
|
||||
// from interface Logger.Factory
|
||||
public Logger getLogger (Class clazz)
|
||||
public Logger getLogger (Class<?> clazz)
|
||||
{
|
||||
return getLogger(clazz.getName());
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public final class Log
|
||||
try {
|
||||
provider = System.getProperty("log_provider");
|
||||
if (provider != null) {
|
||||
Class lpclass = Class.forName(provider);
|
||||
Class<?> lpclass = Class.forName(provider);
|
||||
_provider = (LogProvider)lpclass.newInstance();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Log4JLogger implements Logger.Factory
|
||||
}
|
||||
|
||||
// from interface Logger.Factory
|
||||
public Logger getLogger (Class clazz)
|
||||
public Logger getLogger (Class<?> clazz)
|
||||
{
|
||||
return getLogger(clazz.getName());
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class Logger
|
||||
{
|
||||
public void init ();
|
||||
public Logger getLogger (String name);
|
||||
public Logger getLogger (Class clazz);
|
||||
public Logger getLogger (Class<?> clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ public abstract class Logger
|
||||
/**
|
||||
* Obtains a logger with a name equal to the supplied class's name.
|
||||
*/
|
||||
public static Logger getLogger (Class clazz)
|
||||
public static Logger getLogger (Class<?> clazz)
|
||||
{
|
||||
return _factory.getLogger(clazz);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class MapEntry<K,V> implements Map.Entry<K,V>
|
||||
if (!(o instanceof Map.Entry)) {
|
||||
return false;
|
||||
}
|
||||
Map.Entry e = (Map.Entry)o;
|
||||
Map.Entry<?, ?> e = (Map.Entry<?, ?>)o;
|
||||
return ObjectUtil.equals(_key, e.getKey()) &&
|
||||
ObjectUtil.equals(_value, e.getValue());
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MethodFinder
|
||||
* @exception IllegalArgumentException if clazz is null, or represents a primitive, or
|
||||
* represents an array type.
|
||||
*/
|
||||
public MethodFinder (Class clazz)
|
||||
public MethodFinder (Class<?> clazz)
|
||||
{
|
||||
if (clazz == null) {
|
||||
throw new IllegalArgumentException("null Class parameter");
|
||||
@@ -91,7 +91,7 @@ public class MethodFinder
|
||||
* @exception NoSuchMethodException if no constructors match the criteria, or if the reflective
|
||||
* call is ambiguous based on the parameter types.
|
||||
*/
|
||||
public Constructor findConstructor (Class[] parameterTypes)
|
||||
public Constructor<?> findConstructor (Class<?>[] parameterTypes)
|
||||
throws NoSuchMethodException
|
||||
{
|
||||
// make sure the constructor list is loaded
|
||||
@@ -101,7 +101,7 @@ public class MethodFinder
|
||||
parameterTypes = new Class[0];
|
||||
}
|
||||
|
||||
return (Constructor)findMemberIn(_ctorList, parameterTypes);
|
||||
return (Constructor<?>)findMemberIn(_ctorList, parameterTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ public class MethodFinder
|
||||
* @exception NoSuchMethodException if no methods match the criteria, or if the reflective call
|
||||
* is ambiguous based on the parameter types, or if methodName is null.
|
||||
*/
|
||||
public Method findMethod (String methodName, Class[] parameterTypes)
|
||||
public Method findMethod (String methodName, Class<?>[] parameterTypes)
|
||||
throws NoSuchMethodException
|
||||
{
|
||||
// make sure the constructor list is loaded
|
||||
@@ -155,14 +155,14 @@ public class MethodFinder
|
||||
* Basis of {@link #findConstructor} and {@link #findMethod}. The member list fed to this
|
||||
* method will be either all {@link Constructor} objects or all {@link Method} objects.
|
||||
*/
|
||||
protected Member findMemberIn (List<Member> memberList, Class[] parameterTypes)
|
||||
protected Member findMemberIn (List<Member> memberList, Class<?>[] parameterTypes)
|
||||
throws NoSuchMethodException
|
||||
{
|
||||
List<Member> matchingMembers = new ArrayList<Member>();
|
||||
|
||||
for (Iterator<Member> it = memberList.iterator(); it.hasNext();) {
|
||||
Member member = it.next();
|
||||
Class[] methodParamTypes = _paramMap.get(member);
|
||||
Class<?>[] methodParamTypes = _paramMap.get(member);
|
||||
|
||||
// check for exactly equal method signature
|
||||
if (Arrays.equals(methodParamTypes, parameterTypes)) {
|
||||
@@ -256,7 +256,7 @@ public class MethodFinder
|
||||
{
|
||||
if (_ctorList == null) {
|
||||
_ctorList = new ArrayList<Member>();
|
||||
Constructor[] ctors = _clazz.getConstructors();
|
||||
Constructor<?>[] ctors = _clazz.getConstructors();
|
||||
for (int i = 0; i < ctors.length; ++i) {
|
||||
_ctorList.add(ctors[i]);
|
||||
_paramMap.put(ctors[i], ctors[i].getParameterTypes());
|
||||
@@ -276,7 +276,7 @@ public class MethodFinder
|
||||
for (int i = 0; i < methods.length; ++i) {
|
||||
Method m = methods[i];
|
||||
String methodName = m.getName();
|
||||
Class[] paramTypes = m.getParameterTypes();
|
||||
Class<?>[] paramTypes = m.getParameterTypes();
|
||||
|
||||
List<Member> list = _methodMap.get(methodName);
|
||||
if (list == null) {
|
||||
@@ -306,13 +306,13 @@ public class MethodFinder
|
||||
*/
|
||||
protected boolean memberIsMoreSpecific (Member first, Member second)
|
||||
{
|
||||
Class[] firstParamTypes = _paramMap.get(first);
|
||||
Class[] secondParamTypes = _paramMap.get(second);
|
||||
Class<?>[] firstParamTypes = _paramMap.get(first);
|
||||
Class<?>[] secondParamTypes = _paramMap.get(second);
|
||||
return ClassUtil.compatibleClasses(secondParamTypes, firstParamTypes);
|
||||
}
|
||||
|
||||
/** The target class to look for methods and constructors in. */
|
||||
protected Class _clazz;
|
||||
protected Class<?> _clazz;
|
||||
|
||||
/** Mapping from method name to the Methods in the target class with that name. */
|
||||
protected Map<String,List<Member>> _methodMap = null;
|
||||
@@ -322,5 +322,5 @@ public class MethodFinder
|
||||
|
||||
/** Mapping from a Constructor or Method object to the Class objects representing its formal
|
||||
* parameters. */
|
||||
protected Map<Member,Class[]> _paramMap = new HashMap<Member,Class[]>();
|
||||
protected Map<Member,Class<?>[]> _paramMap = new HashMap<Member,Class<?>[]>();
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract class Predicate<T>
|
||||
*/
|
||||
public static class InstanceOf<T> extends Predicate<T>
|
||||
{
|
||||
public InstanceOf (Class clazz)
|
||||
public InstanceOf (Class<?> clazz)
|
||||
{
|
||||
_class = clazz;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public abstract class Predicate<T>
|
||||
}
|
||||
|
||||
/** The class that must be implemented by applicants. */
|
||||
protected Class _class;
|
||||
protected Class<?> _class;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -162,7 +162,7 @@ public class PropertiesUtil
|
||||
int preflen = prefix.length();
|
||||
|
||||
// scan the source properties
|
||||
Enumeration names = source.propertyNames();
|
||||
Enumeration<?> names = source.propertyNames();
|
||||
while (names.hasMoreElements()) {
|
||||
String name = (String)names.nextElement();
|
||||
// skip unrelated properties
|
||||
|
||||
@@ -481,11 +481,11 @@ public class StringUtil
|
||||
buf.append(closeBox);
|
||||
|
||||
} else if (val instanceof Iterable) {
|
||||
toString(buf, ((Iterable)val).iterator(), openBox, closeBox);
|
||||
toString(buf, ((Iterable<?>)val).iterator(), openBox, closeBox);
|
||||
|
||||
} else if (val instanceof Iterator) {
|
||||
buf.append(openBox);
|
||||
Iterator iter = (Iterator)val;
|
||||
Iterator<?> iter = (Iterator<?>)val;
|
||||
for (int i = 0; iter.hasNext(); i++) {
|
||||
if (i > 0) {
|
||||
buf.append(sep);
|
||||
@@ -496,7 +496,7 @@ public class StringUtil
|
||||
|
||||
} else if (val instanceof Enumeration) {
|
||||
buf.append(openBox);
|
||||
Enumeration enm = (Enumeration)val;
|
||||
Enumeration<?> enm = (Enumeration<?>)val;
|
||||
for (int i = 0; enm.hasMoreElements(); i++) {
|
||||
if (i > 0) {
|
||||
buf.append(sep);
|
||||
@@ -551,7 +551,7 @@ public class StringUtil
|
||||
{
|
||||
// get an iterator if this is a collection
|
||||
if (val instanceof Iterable) {
|
||||
val = ((Iterable)val).iterator();
|
||||
val = ((Iterable<?>)val).iterator();
|
||||
}
|
||||
|
||||
String openBox = formatter.getOpenBox();
|
||||
@@ -570,7 +570,7 @@ public class StringUtil
|
||||
|
||||
} else if (val instanceof Iterator) {
|
||||
buf.append(openBox);
|
||||
Iterator iter = (Iterator)val;
|
||||
Iterator<?> iter = (Iterator<?>)val;
|
||||
for (int i = 0; iter.hasNext(); i++) {
|
||||
if (i > 0) {
|
||||
buf.append(", ");
|
||||
@@ -581,7 +581,7 @@ public class StringUtil
|
||||
|
||||
} else if (val instanceof Enumeration) {
|
||||
buf.append(openBox);
|
||||
Enumeration enm = (Enumeration)val;
|
||||
Enumeration<?> enm = (Enumeration<?>)val;
|
||||
for (int i = 0; enm.hasMoreElements(); i++) {
|
||||
if (i > 0) {
|
||||
buf.append(", ");
|
||||
@@ -759,7 +759,7 @@ public class StringUtil
|
||||
char[] chars = new char[count*2];
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
int val = (int)bytes[i];
|
||||
int val = bytes[i];
|
||||
if (val < 0) {
|
||||
val += 256;
|
||||
}
|
||||
@@ -1199,7 +1199,7 @@ public class StringUtil
|
||||
* name. For example, <code>com.samskivert.util.StringUtil</code> would be reported as
|
||||
* <code>util.StringUtil</code>.
|
||||
*/
|
||||
public static String shortClassName (Class clazz)
|
||||
public static String shortClassName (Class<?> clazz)
|
||||
{
|
||||
return shortClassName(clazz.getName());
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Tuple<L,R> implements Serializable
|
||||
public boolean equals (Object other)
|
||||
{
|
||||
if (other instanceof Tuple) {
|
||||
Tuple to = (Tuple)other;
|
||||
Tuple<?, ?> to = (Tuple<?, ?>)other;
|
||||
return (left.equals(to.left) && right.equals(to.right));
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ValueMarshaller
|
||||
* @exception Exception thrown if no field parser exists for the
|
||||
* target type or if an error occurs while parsing the value.
|
||||
*/
|
||||
public static Object unmarshal (Class type, String source)
|
||||
public static Object unmarshal (Class<?> type, String source)
|
||||
throws Exception
|
||||
{
|
||||
// look up an argument parser for the field type
|
||||
@@ -56,10 +56,10 @@ public class ValueMarshaller
|
||||
public Object parse (String source) throws Exception;
|
||||
}
|
||||
|
||||
protected static HashMap<Class,Parser> _parsers;
|
||||
protected static HashMap<Class<?>,Parser> _parsers;
|
||||
|
||||
static {
|
||||
_parsers = new HashMap<Class,Parser>();
|
||||
_parsers = new HashMap<Class<?>,Parser>();
|
||||
|
||||
// we can parse strings
|
||||
_parsers.put(String.class, new Parser() {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ConfigTest extends TestCase
|
||||
config.setValue("prop2", "three");
|
||||
System.out.println("prop2: " + config.getValue("prop2", "two"));
|
||||
|
||||
Iterator iter = config.keys();
|
||||
Iterator<String> iter = config.keys();
|
||||
System.out.println("Keys: " + StringUtil.toString(iter));
|
||||
|
||||
config.setValue("sub.sub3", "three");
|
||||
|
||||
@@ -149,7 +149,7 @@ public class DispatcherServlet extends HttpServlet
|
||||
if (StringUtil.isBlank(appcl)) {
|
||||
_app = new Application();
|
||||
} else {
|
||||
Class appclass = Class.forName(appcl);
|
||||
Class<?> appclass = Class.forName(appcl);
|
||||
_app = (Application)appclass.newInstance();
|
||||
}
|
||||
|
||||
@@ -418,6 +418,7 @@ public class DispatcherServlet extends HttpServlet
|
||||
* Called when a method throws an exception during template
|
||||
* evaluation.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object methodException (Class clazz, String method, Exception e)
|
||||
throws Exception
|
||||
{
|
||||
@@ -580,7 +581,7 @@ public class DispatcherServlet extends HttpServlet
|
||||
|
||||
if (logic == null) {
|
||||
try {
|
||||
Class pcl = Class.forName(lclass);
|
||||
Class<?> pcl = Class.forName(lclass);
|
||||
logic = (Logic)pcl.newInstance();
|
||||
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
|
||||
@@ -116,7 +116,7 @@ public class InvocationContext extends VelocityContext
|
||||
@Deprecated
|
||||
public void putAllParameters ()
|
||||
{
|
||||
Enumeration e = _req.getParameterNames();
|
||||
Enumeration<?> e = _req.getParameterNames();
|
||||
while (e.hasMoreElements()) {
|
||||
String param = (String)e.nextElement();
|
||||
put(param, _req.getParameter(param));
|
||||
@@ -130,7 +130,7 @@ public class InvocationContext extends VelocityContext
|
||||
public String encodeAllParameters ()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
Enumeration e = _req.getParameterNames();
|
||||
Enumeration<?> e = _req.getParameterNames();
|
||||
while (e.hasMoreElements()) {
|
||||
if (buf.length() > 0) {
|
||||
buf.append('&');
|
||||
|
||||
@@ -45,7 +45,7 @@ public class SetNextFieldRule extends Rule
|
||||
// identify the objects to be used
|
||||
Object child = digester.peek(0);
|
||||
Object parent = digester.peek(1);
|
||||
Class pclass = parent.getClass();
|
||||
Class<?> pclass = parent.getClass();
|
||||
|
||||
if (digester.getLogger().isDebugEnabled()) {
|
||||
digester.getLogger().debug("Set " + pclass.getName() + "." +
|
||||
|
||||
@@ -85,10 +85,10 @@ public class SetPropertyFieldsRule extends Rule
|
||||
throws Exception
|
||||
{
|
||||
Object top = digester.peek();
|
||||
Class topclass = top.getClass();
|
||||
Class<?> topclass = top.getClass();
|
||||
|
||||
// iterate over the attributes, setting public fields where applicable
|
||||
for (int i = 0; i < attrs.getLength(); i++) {
|
||||
for (int i = 0; i < attrs.getLength(); i++) {
|
||||
String lname = attrs.getLocalName(i);
|
||||
if (StringUtil.isBlank(lname)) {
|
||||
lname = attrs.getQName(i);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ValidatedSetNextRule extends Rule
|
||||
* specified parameter type.
|
||||
*/
|
||||
public ValidatedSetNextRule (
|
||||
String methodName, Class paramType, Validator validator)
|
||||
String methodName, Class<?> paramType, Validator validator)
|
||||
{
|
||||
// keep this for later
|
||||
_methodName = methodName;
|
||||
@@ -81,14 +81,14 @@ public class ValidatedSetNextRule extends Rule
|
||||
return;
|
||||
}
|
||||
|
||||
Class pclass = parent.getClass();
|
||||
Class<?> pclass = parent.getClass();
|
||||
if (digester.getLogger().isDebugEnabled()) {
|
||||
digester.getLogger().debug("Call " + pclass.getName() + "." +
|
||||
_methodName + " (" + child + ")");
|
||||
}
|
||||
|
||||
// call the specified method
|
||||
Class[] paramTypes = new Class[1];
|
||||
Class<?>[] paramTypes = new Class<?>[1];
|
||||
paramTypes[0] = (_paramType == null) ? child.getClass() : _paramType;
|
||||
Method method = parent.getClass().getMethod(_methodName, paramTypes);
|
||||
method.invoke(parent, new Object[] { child });
|
||||
@@ -111,6 +111,6 @@ public class ValidatedSetNextRule extends Rule
|
||||
}
|
||||
|
||||
protected String _methodName;
|
||||
protected Class _paramType;
|
||||
protected Class<?> _paramType;
|
||||
protected Validator _validator;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user