Modifier | Constructor | Description |
---|---|---|
protected |
BasePojomator(Class<?> pojoClass,
ClassProperties classProperties) |
Modifier and Type | Method | Description |
---|---|---|
protected static boolean |
areObjectValuesEqual(Object instanceValue,
Object otherValue) |
Compare two values of static type Object for equality.
|
protected static int |
arrayHashCode(Object array,
boolean deepArray) |
Given an object which is of array type, compute it's hashCode by calling the appropriate signature of
Arrays .hashCode() |
protected static CallSite |
bootstrap(MethodHandles.Lookup caller,
String name,
MethodType methodType,
Class<?> pojomatorClass) |
Construct a call site for a property accessor.
|
protected void |
checkCompatibleForEquality(T instance,
String label) |
|
protected static <T> T |
checkNotNull(T reference) |
|
protected static <T> T |
checkNotNull(T reference,
String message) |
|
protected static void |
checkNotNullPop(Object reference) |
|
protected static boolean |
compareArrays(Object instanceValue,
Object otherValue) |
Compare two values of array type for equality.
|
boolean |
isCompatibleForEquality(Class<?> otherClass) |
Compute whether
otherClass is compatible for equality with T . |
String |
toString() |
Return a simple String representation of this Pojomator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
doDiff, doEquals, doHashCode, doToString
protected final Class<?> pojoClass
protected BasePojomator(Class<?> pojoClass, ClassProperties classProperties)
public boolean isCompatibleForEquality(Class<?> otherClass)
Pojomator
otherClass
is compatible for equality with T
.
Classes A
and B
are compatible for equality if
they share a common superclass C
, and for every class D
which
is a proper subclass of C
and a superclass of A
or B
(including
the classes A
and B
themselves), the following hold:
D
has not added additional properties for inclusion in the equals
calculation, andD
has not been annotated with OverridesEquals
T
is an interface or is annotated with SubclassCannotOverrideEquals
,
then all subclasses of T
are automatically assumed by T
's Pojomator
to be compatible for equals with each other and with T
. Note that in this case.
to add an OverridesEquals
annotation or additional
properties for inclusion in equals
to a subclass of T
will
result in a violation of the contract for Object.equals(Object)
.isCompatibleForEquality
in interface Pojomator<T>
otherClass
- the class to check for compatibility for equality with T
true
if otherClass
is compatible for equality with T
, and
false
otherwise.public String toString()
Pojomator
protected static CallSite bootstrap(MethodHandles.Lookup caller, String name, MethodType methodType, Class<?> pojomatorClass) throws Throwable
pojoClass
might not be a public class, the
parameter in methodType
cannot be pojoClass
, but instead must be just Object.class
. The
pojoClass
parameter will be stored as static field in the Pojomator class, and passed in from it's
bootstrap method.caller
- A Lookup from the original call site.name
- the name of the dynamic method. This should either be "field_<fieldName>" or "method_<methodName>".methodType
- the type of the dynamic method; the return type should be the type of the aforementioned field
or methodpojomatorClass
- the type of the pojomator classThrowable
- if there are reflection issuesprotected static boolean areObjectValuesEqual(Object instanceValue, Object otherValue)
instanceValue
- the first value to compareotherValue
- the second value to compareinstanceValue
and otherValue
are equal to each other.protected static boolean compareArrays(Object instanceValue, Object otherValue)
instanceValue
- the first value to compareotherValue
- the second value to compareinstanceValue
and otherValue
are equal to each other.protected static int arrayHashCode(Object array, boolean deepArray)
Arrays
.hashCode()
array
- the arraydeepArray
- whether to do a deep hashCode for Object arrays.protected static <T> T checkNotNull(T reference)
protected static <T> T checkNotNull(T reference, String message)
protected static void checkNotNullPop(Object reference)
Copyright © 2008–2018. All rights reserved.