|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.lang.Objects
public class Objects
Utilities related to the Object class.
Field Summary | |
---|---|
static java.lang.String |
BAR0_STRING
Deprecated. As of release 6.0.0, not worth to have this API. |
static java.lang.String |
BAR1_STRING
Deprecated. As of release 6.0.0, not worth to have this API. |
static java.lang.String |
BAR2_STRING
Deprecated. As of release 6.0.0, not worth to have this API. |
static java.lang.Character |
NULL_CHARACTER
The null character. |
static char |
PATH_SEPARATOR_CHAR
Deprecated. As of release 6.0.0, never used and confusing. |
static java.lang.String |
PATH_SEPARATOR_STRING
Deprecated. As of release 6.0.0, never used and confusing. |
static java.lang.Object |
UNKNOWN
Denotes unknown. |
static java.math.BigDecimal |
ZERO_BIG_DECIMAL
Represents 0 in big decimal. |
static java.math.BigInteger |
ZERO_BIG_INTEGER
Represents 0 in big integer. |
static java.lang.Byte |
ZERO_BYTE
The zero integer. |
static java.lang.Double |
ZERO_DOUBLE
The zero double. |
static java.lang.Float |
ZERO_FLOAT
The zero float. |
static java.lang.Integer |
ZERO_INTEGER
The zero integer. |
static java.lang.Long |
ZERO_LONG
The zero long. |
static java.lang.Short |
ZERO_SHORT
The zero short. |
Constructor Summary | |
---|---|
Objects()
|
Method Summary | |
---|---|
static java.lang.Object |
clone(java.lang.Object o)
Clones the specified object. |
static boolean |
equals(java.lang.Object a,
java.lang.Object b)
Tests whether two objects are equals. |
static int |
hashCode(boolean[] v)
Generates hash codes for an array of boolean. |
static int |
hashCode(byte[] v)
Generates hash codes for an array of bytes. |
static int |
hashCode(byte[] v,
int len)
Generates hash codes for an array of bytes up to the specified length. |
static int |
hashCode(char[] v)
Generates hash codes for an array. |
static int |
hashCode(int[] v)
Generates hash codes for an array. |
static int |
hashCode(long[] v)
Generates hash codes for an array. |
static int |
hashCode(java.lang.Object o)
Returns the object's hash code, or zero if null. |
static int |
hashCode(short[] v)
Generates hash codes for an array. |
static int |
nextHashCode(int prevHashVal,
int newVal)
Returns the next hash value by giving the previous one and a new one. |
static byte[] |
toByteArray(byte v)
Converts a byte to a big-endian byte array. |
static byte[] |
toByteArray(int v)
Converts an integer to a big-endian byte array. |
static byte[] |
toByteArray(long v)
Converts a long to a big-endian byte array. |
static byte[] |
toByteArray(short v)
Converts a short to a big-endian byte array. |
static char[] |
toCharArray(java.lang.Object o)
Converts any object to a character array. |
static java.lang.String |
toString(java.lang.Object o)
Converts any object to a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Object UNKNOWN
public static final java.lang.Long ZERO_LONG
public static final java.lang.Integer ZERO_INTEGER
public static final java.lang.Short ZERO_SHORT
public static final java.lang.Byte ZERO_BYTE
public static final java.lang.Float ZERO_FLOAT
public static final java.lang.Double ZERO_DOUBLE
public static final java.math.BigDecimal ZERO_BIG_DECIMAL
BigDecimals.ZERO
.
BigDecimals.ONE
public static final java.math.BigInteger ZERO_BIG_INTEGER
BigIntegers.ZERO
.
public static final java.lang.Character NULL_CHARACTER
public static final char PATH_SEPARATOR_CHAR
public static final java.lang.String PATH_SEPARATOR_STRING
public static final java.lang.String BAR0_STRING
public static final java.lang.String BAR1_STRING
public static final java.lang.String BAR2_STRING
Constructor Detail |
---|
public Objects()
Method Detail |
---|
public static final int nextHashCode(int prevHashVal, int newVal)
prevHashVal
- the previous hash value returned by this method; 0
if it is the first call.newVal
- the new value to put in
public static final int hashCode(boolean[] v)
v
- the array
public static final int hashCode(byte[] v)
v
- the array
public static final int hashCode(byte[] v, int len)
v
- the arraylen
- the maximal length to generate hashCode
public static final int hashCode(char[] v)
v
- the array
public static final int hashCode(short[] v)
v
- the array
public static final int hashCode(int[] v)
v
- the byte array
public static final int hashCode(long[] v)
v
- the array
public static final int hashCode(java.lang.Object o)
public static final boolean equals(java.lang.Object a, java.lang.Object b)
It takes care of the null case. Thus, it is helpful to implement Object.equals.
Notice: it uses compareTo if BigDecimal is found. So, in this case, a.equals(b) might not be the same as Objects.equals(a, b).
If both a and b are Object[], they are compared item-by-item.
public static final char[] toCharArray(java.lang.Object o)
o
- the object to convert
public static final java.lang.String toString(java.lang.Object o)
ArraysX.toString(java.lang.Object[])
to make the string more readable.
public static final byte[] toByteArray(int v)
public static final byte[] toByteArray(long v)
public static final byte[] toByteArray(short v)
public static final byte[] toByteArray(byte v)
public static final java.lang.Object clone(java.lang.Object o)
If o is null, null is returned.
SystemException
- if failed to clone
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |