Modifier and Type | Method and Description |
---|---|
static String |
getObjectName(Object object)
Gets the object name from the supplied object.
|
static boolean |
isEqual(Object left,
Object right)
Determines whether the left object equals the right object.
|
public static String getObjectName(Object object)
object
- The object to get the name for.NullPointerException
- When the supplied object is null.public static boolean isEqual(Object left, Object right)
boolean result =
left == null && right == null || (left != null && right != null && left.equals(right));
This code results in a high McCabe complexity. With this utility method, you simple write:boolean result = ObjectUtil.isEqual(left, right);
.left
- The left object.right
- The right object.Copyright © 2008–2018. All rights reserved.