OPENJPA-2665 use Objects.equals instead of prorietary impl

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1759614 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Struberg 2016-09-07 13:55:30 +00:00
parent 10110aadf0
commit f979ae1cfe
18 changed files with 49 additions and 50 deletions

View File

@ -23,8 +23,8 @@ import java.sql.SQLException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
import org.apache.openjpa.jdbc.kernel.JDBCStoreQuery;
import org.apache.openjpa.jdbc.meta.ClassMapping;
@ -61,10 +61,8 @@ import org.apache.openjpa.util.UserException;
*
* @author Abe White
*/
public class PCPath
extends CandidatePath
implements JDBCPath {
public class PCPath extends CandidatePath implements JDBCPath {
protected static final String TRUE = "1 = 1";
protected static final String FALSE = "1 <> 1";
@ -1112,8 +1110,8 @@ public class PCPath
if (!(other instanceof PCPath))
return false;
PCPath path = (PCPath) other;
return ObjectUtils.equals(_candidate, path._candidate)
&& ObjectUtils.equals(_actions, path._actions);
return Objects.equals(_candidate, path._candidate)
&& Objects.equals(_actions, path._actions);
}
public int getId() {
@ -1158,7 +1156,7 @@ public class PCPath
return true;
Action a = (Action) other;
return op == a.op
&& ObjectUtils.equals(data, a.data);
&& Objects.equals(data, a.data);
}
}
}

View File

@ -24,8 +24,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.openjpa.jdbc.identifier.DBIdentifier;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.lib.log.Log;
@ -558,7 +558,7 @@ public class ForeignKey
* Join a local column to a primary key column of another table.
*/
public void join(Column local, Column toPK) {
if (!ObjectUtils.equals(local.getTable(), getTable()))
if (!Objects.equals(local.getTable(), getTable()))
throw new InvalidStateException(_loc.get("table-mismatch",
local.getTable(), getTable()));
@ -776,7 +776,7 @@ public class ForeignKey
if (vals.length != fkVals.length)
return false;
for (int i = 0; i < vals.length; i++)
if (!ObjectUtils.equals(vals[i], fkVals[i]))
if (!Objects.equals(vals[i], fkVals[i]))
return false;
return true;
}

View File

@ -25,7 +25,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
/**
* Set type that recognizes that inner joins should take precedence
@ -382,8 +382,8 @@ class JoinSet {
if (!(other instanceof Node))
return false;
Node node = (Node) other;
return ObjectUtils.equals(join, node.join)
&& ObjectUtils.equals(next, node.next);
return Objects.equals(join, node.join)
&& Objects.equals(next, node.next);
}
public Object clone() {

View File

@ -20,7 +20,7 @@ package org.apache.openjpa.jdbc.sql;
import java.sql.SQLException;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.openjpa.jdbc.meta.ClassMapping;
import org.apache.openjpa.jdbc.meta.RelationId;
import org.apache.openjpa.jdbc.schema.Column;
@ -380,7 +380,7 @@ public class PrimaryRow
* Return true if the two values should be considered equal.
*/
private static boolean rowValueEquals(Object o1, Object o2) {
if (ObjectUtils.equals(o1, o2))
if (Objects.equals(o1, o2))
return true;
// check for numeric equality (bug #1151)

View File

@ -29,7 +29,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.openjpa.jdbc.identifier.DBIdentifier;
import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
import org.apache.openjpa.jdbc.kernel.exps.CollectionParam;
@ -630,7 +630,7 @@ public final class SQLBuffer
SQLBuffer buf = (SQLBuffer) other;
return _sql.equals(buf._sql)
&& ObjectUtils.equals(_params, buf._params);
&& Objects.equals(_params, buf._params);
}
/**

View File

@ -24,7 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.openjpa.util.RuntimeExceptionTranslator;
/**
@ -85,7 +85,7 @@ public class DelegatingDataCache
return true;
if (other instanceof DelegatingDataCache)
other = ((DelegatingDataCache) other).getInnermostDelegate();
return ObjectUtils.equals(getInnermostDelegate(), other);
return Objects.equals(getInnermostDelegate(), other);
}
/**

View File

@ -18,7 +18,7 @@
*/
package org.apache.openjpa.datacache;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.openjpa.kernel.QueryStatistics;
import org.apache.openjpa.util.RuntimeExceptionTranslator;
@ -77,7 +77,7 @@ public class DelegatingQueryCache
return true;
if (other instanceof DelegatingQueryCache)
other = ((DelegatingQueryCache) other).getInnermostDelegate();
return ObjectUtils.equals(getInnermostDelegate(), other);
return Objects.equals(getInnermostDelegate(), other);
}
/**

View File

@ -36,7 +36,7 @@ import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.enhance.PCRegistry;
import org.apache.openjpa.kernel.Query;
@ -408,8 +408,8 @@ public class QueryKey
&& _ignoreChanges == other._ignoreChanges
&& _rangeStart == other._rangeStart
&& _rangeEnd == other._rangeEnd
&& ObjectUtils.equals(_query, other._query)
&& ObjectUtils.equals(_params, other._params);
&& Objects.equals(_query, other._query)
&& Objects.equals(_params, other._params);
}
/**

View File

@ -25,7 +25,7 @@ import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.openjpa.enhance.PersistenceCapable;
import org.apache.openjpa.enhance.StateManager;
import org.apache.openjpa.lib.util.Localizer;
@ -225,7 +225,7 @@ abstract class AttachStrategy
else {
PersistenceCapable intopc = topc;
if (!fmd.isEmbeddedPC() && frmpc != null && topc != null
&& !ObjectUtils.equals(topc.pcFetchObjectId(),
&& !Objects.equals(topc.pcFetchObjectId(),
manager.getDetachedObjectId(frmpc))) {
intopc = null;
}

View File

@ -33,7 +33,7 @@ import java.util.Map.Entry;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.commons.collections.map.LinkedMap;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.conf.OpenJPAConfiguration;
import org.apache.openjpa.enhance.PersistenceCapable;
@ -1848,7 +1848,7 @@ public class QueryImpl
return false;
if (key.subclasses != subclasses)
return false;
if (!ObjectUtils.equals(key.storeKey, storeKey))
if (!Objects.equals(key.storeKey, storeKey))
return false;
// allow either candidate type to be null because it might be

View File

@ -22,7 +22,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.openjpa.kernel.Broker;
import org.apache.openjpa.kernel.Filters;
import org.apache.openjpa.kernel.OpenJPAStateManager;
@ -161,7 +161,7 @@ public class CandidatePath
return true;
if (!(other instanceof CandidatePath))
return false;
return ObjectUtils.equals(_actions, ((CandidatePath) other)._actions);
return Objects.equals(_actions, ((CandidatePath) other)._actions);
}
/**

View File

@ -30,7 +30,7 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.openjpa.kernel.Extent;
import org.apache.openjpa.kernel.StoreContext;
import org.apache.openjpa.lib.util.Localizer;
@ -140,7 +140,7 @@ public class InMemoryExpressionFactory
for (int i = 0; i < exps.grouping.length; i++) {
curs[i] = ((Val) exps.grouping[i]).evaluate(pc, pc, ctx,
params);
eq = eq && ObjectUtils.equals(prevs[i], curs[i]);
eq = eq && Objects.equals(prevs[i], curs[i]);
}
// if this object's grouping values differ from the prev,
@ -695,7 +695,7 @@ public class InMemoryExpressionFactory
if (_arr.length != arr.length)
return false;
for (int i = 0; i < _arr.length; i++)
if (!ObjectUtils.equals(_arr[i], arr[i]))
if (!Objects.equals(_arr[i], arr[i]))
return false;
return true;
}

View File

@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.util.MetaDataException;
@ -375,7 +375,7 @@ public class FetchGroup
return false;
FetchGroup that = (FetchGroup) other;
return _name.equals(that._name)
&& ObjectUtils.equals(_meta, that._meta);
&& Objects.equals(_meta, that._meta);
}
public int hashCode() {

View File

@ -19,8 +19,9 @@
package org.apache.openjpa.util;
import java.util.BitSet;
import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
import java.util.Objects;
/**
* Utilities for dealing with a simple state image consisting of an
@ -98,7 +99,7 @@ public class ArrayStateImage {
BitSet loaded2 = getLoaded(state2);
for (int i = 0, max = loaded1.length(); i < max; i++) {
if (loaded1.get(i) && loaded2.get(i)
&& !ObjectUtils.equals(state1[i], state2[i]))
&& !Objects.equals(state1[i], state2[i]))
return false;
}
return true;

View File

@ -20,8 +20,8 @@ package org.apache.openjpa.lib.conf;
import java.io.File;
import java.security.AccessController;
import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.openjpa.lib.util.J2DoPrivHelper;
/**
@ -48,7 +48,7 @@ public class FileValue extends Value {
assertChangeable();
File oldValue = this.value;
this.value = value;
if (!ObjectUtils.equals(oldValue, value))
if (!Objects.equals(oldValue, value))
valueChanged();
}

View File

@ -19,8 +19,8 @@
package org.apache.openjpa.lib.conf;
import java.security.AccessController;
import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.openjpa.lib.util.J2DoPrivHelper;
import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.lib.util.ReferenceMap;
@ -69,7 +69,7 @@ public class ObjectValue extends Value {
if (!derived) assertChangeable();
Object oldValue = _value;
_value = obj;
if (!derived && !ObjectUtils.equals(obj, oldValue)) {
if (!derived && !Objects.equals(obj, oldValue)) {
objectChanged();
valueChanged();
}

View File

@ -25,8 +25,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
/**
* Abstract base class for random-access result lists. Unlike the
@ -53,7 +53,7 @@ public abstract class AbstractNonSequentialResultList
obj = getInternal(i);
if (obj == PAST_END)
break;
if (ObjectUtils.equals(o, obj))
if (Objects.equals(o, obj))
return true;
}
return false;
@ -82,7 +82,7 @@ public abstract class AbstractNonSequentialResultList
obj = getInternal(i);
if (obj == PAST_END)
break;
if (ObjectUtils.equals(o, obj))
if (Objects.equals(o, obj))
return i;
}
return -1;
@ -96,7 +96,7 @@ public abstract class AbstractNonSequentialResultList
obj = getInternal(i);
if (obj == PAST_END)
break;
if (ObjectUtils.equals(o, obj))
if (Objects.equals(o, obj))
index = i;
}
return index;

View File

@ -23,8 +23,8 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
/**
* Abstract base class for sequential result lists. Unlike the
@ -43,7 +43,7 @@ public abstract class AbstractSequentialResultList extends AbstractResultList {
public boolean contains(Object o) {
assertOpen();
for (Iterator itr = itr(0); itr.hasNext();)
if (ObjectUtils.equals(o, itr.next()))
if (Objects.equals(o, itr.next()))
return true;
return false;
}
@ -65,7 +65,7 @@ public abstract class AbstractSequentialResultList extends AbstractResultList {
assertOpen();
int index = 0;
for (Iterator itr = itr(0); itr.hasNext(); index++)
if (ObjectUtils.equals(o, itr.next()))
if (Objects.equals(o, itr.next()))
return index;
return -1;
}
@ -75,7 +75,7 @@ public abstract class AbstractSequentialResultList extends AbstractResultList {
int index = -1;
int i = 0;
for (Iterator itr = itr(0); itr.hasNext(); i++)
if (ObjectUtils.equals(o, itr.next()))
if (Objects.equals(o, itr.next()))
index = i;
return index;
}