net.ontopia.utils
Class ObjectUtils

java.lang.Object
  extended by net.ontopia.utils.ObjectUtils

public class ObjectUtils
extends java.lang.Object

INTERNAL: Class that contains useful methods.


Method Summary
static int compare(java.lang.Comparable o1, java.lang.Comparable o2)
          INTERNAL: Compares two objects or null values in a consistent way.
static int compare(double d1, double d2)
          INTERNAL: Compares two double values.
static int compare(int i1, int i2)
          INTERNAL: Compares two int values.
static int compare(java.lang.Object o1, java.lang.Object o2, java.util.Comparator c)
          INTERNAL: Compares two objects or null values in a consistent way using the given comparator.
static int compareArrays(java.lang.Object[] a1, java.lang.Object[] a2, java.util.Comparator c)
          INTERNAL: Compare array size, then each element in sequence using a comparator.
static int compareIgnoreCase(java.lang.String s1, java.lang.String s2)
          INTERNAL: Compares two string or null values in a consistent way ignoring the case.
static boolean different(java.lang.Object o1, java.lang.Object o2)
          INTERNAL: Returns true if the two objects are different.
static boolean equals(java.lang.Object o1, java.lang.Object o2)
          INTERNAL: Returns true if the two objects are equals.
static java.lang.Object getProperty(java.lang.Object bean, java.lang.String propertyName)
          INTERNAL: Get bean property value from object.
static java.lang.Object getProperty(java.lang.Object bean, java.lang.String propertyName, java.lang.Object _default)
          INTERNAL: Get bean property value from object.
static java.lang.Throwable getRealCause(java.lang.Throwable t)
          INTERNAL: Extract real exception from wrapper exception.
static boolean isTrue(java.lang.Object value)
          INTERNAL: Returns boolean value if Boolean object.
static java.lang.Object newInstance(java.lang.String className)
          INTERNAL: Create new instance of given class.
static void sortParallel(java.lang.Object[] x, java.lang.Object[] y, java.util.Comparator c)
           
static void throwRuntimeException(java.lang.Throwable t)
          INTERNAL: Extract real exception from wrapper exception and rethrow as a RuntimeException.
static int toInteger(java.lang.String value, int _default)
          INTERNAL: Casts string to int value, returns default if it fails.
static java.lang.String toString(java.lang.Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

different

public static boolean different(java.lang.Object o1,
                                java.lang.Object o2)
INTERNAL: Returns true if the two objects are different. The method handle null values without throwing a NullPointerException. Null equals null.


equals

public static boolean equals(java.lang.Object o1,
                             java.lang.Object o2)
INTERNAL: Returns true if the two objects are equals. The method handle null values without throwing a NullPointerException. Null equals null.


compare

public static int compare(int i1,
                          int i2)
INTERNAL: Compares two int values.


compare

public static int compare(double d1,
                          double d2)
INTERNAL: Compares two double values. Note that this method is included in Java 1.4, but we've included it here because we have to support Java 1.3.


compareIgnoreCase

public static int compareIgnoreCase(java.lang.String s1,
                                    java.lang.String s2)
INTERNAL: Compares two string or null values in a consistent way ignoring the case. Will not throw a NullPointerException if any of the arguments are null.

Since:
3.4

compare

public static int compare(java.lang.Comparable o1,
                          java.lang.Comparable o2)
INTERNAL: Compares two objects or null values in a consistent way. Will not throw a NullPointerException if any of the arguments are null.

Since:
3.4

compare

public static int compare(java.lang.Object o1,
                          java.lang.Object o2,
                          java.util.Comparator c)
INTERNAL: Compares two objects or null values in a consistent way using the given comparator. Will not throw a NullPointerException if any of the arguments are null.

Since:
3.4

getProperty

public static java.lang.Object getProperty(java.lang.Object bean,
                                           java.lang.String propertyName)
INTERNAL: Get bean property value from object.


getProperty

public static java.lang.Object getProperty(java.lang.Object bean,
                                           java.lang.String propertyName,
                                           java.lang.Object _default)
INTERNAL: Get bean property value from object. Returns null if property does not exist or fails.


isTrue

public static boolean isTrue(java.lang.Object value)
INTERNAL: Returns boolean value if Boolean object. If not returns false.


toInteger

public static int toInteger(java.lang.String value,
                            int _default)
INTERNAL: Casts string to int value, returns default if it fails.


newInstance

public static java.lang.Object newInstance(java.lang.String className)
INTERNAL: Create new instance of given class. Class must have a default constructor.


getRealCause

public static java.lang.Throwable getRealCause(java.lang.Throwable t)
INTERNAL: Extract real exception from wrapper exception.


throwRuntimeException

public static void throwRuntimeException(java.lang.Throwable t)
INTERNAL: Extract real exception from wrapper exception and rethrow as a RuntimeException.


sortParallel

public static void sortParallel(java.lang.Object[] x,
                                java.lang.Object[] y,
                                java.util.Comparator c)

compareArrays

public static int compareArrays(java.lang.Object[] a1,
                                java.lang.Object[] a2,
                                java.util.Comparator c)
INTERNAL: Compare array size, then each element in sequence using a comparator.


toString

public static java.lang.String toString(java.lang.Object o)


Copyright © 2000-2012 Ontopia.