Tools (Hibernate JavaDocs)
Date: 2012-04-05

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.envers.tools
Class Tools

    java.lang.Object
      org.hibernate.envers.tools.Tools

    public class Tools

extends Object

Constructor Summary
`Tools()`

Method Summary
`static boolean` | `arraysEqual(Object[] array1, Object[] array2)`
`static boolean` | `entitiesEqual(SessionImplementor session, String entityName, Object obj1, Object obj2)`
`static Class` | `getEntityClass(SessionImplementor sessionImplementor, Session session, String entityName)`
`static Object` | `getIdentifier(SessionImplementor session, String entityName, Object obj)`
`static String` | `getProperty(Properties properties, String propertyName, String legacyPropertyName, String defaultValue)`
`static org.hibernate.annotations.common.reflection.XProperty` | `getProperty(org.hibernate.annotations.common.reflection.XClass clazz, String propertyName)`
`static org.hibernate.annotations.common.reflection.XProperty` | `getProperty(org.hibernate.annotations.common.reflection.XClass clazz, String propertyName, String accessType)`
`static
`<T> Class<T>`
` | `getTargetClassIfProxied(Class<T> clazz)`
`static Object` | `getTargetFromProxy(SessionFactoryImplementor sessionFactoryImplementor, HibernateProxy proxy)`
`static boolean` | `iteratorsContentEqual(Iterator iter1, Iterator iter2)`
`static
`<T> List<T>`
` | `iteratorToList(Iterator<T> iter)`
`static
`<T> List<Pair<Integer,T>>`
` | `listToIndexElementPairList(List<T> list)` Transforms a list of arbitrary elements to a list of index-element pairs.
`static Object[]` | `mapToArray(Map<String,Object> data, String[] keys)` Converts map's value set to an array.
`static
`<K,V> Map<K,V>`
` | `newHashMap()`
`static
`<E> Set<E>`
` | `newHashSet()`
`static
`<K,V> Map<K,V>`
` | `newLinkedHashMap()`
`static boolean` | `objectsEqual(Object obj1, Object obj2)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Tools

    public Tools()

Method Detail

### newHashMap

    public static <K,V> Map<K,V> newHashMap()

### newHashSet

    public static <E> Set<E> newHashSet()

### newLinkedHashMap

    public static <K,V> Map<K,V> newLinkedHashMap()

### entitiesEqual

    public static boolean entitiesEqual(SessionImplementor session,
                                        String entityName,
                                        Object obj1,
                                        Object obj2)

### getIdentifier

    public static Object getIdentifier(SessionImplementor session,
                                       String entityName,
                                       Object obj)

### getTargetFromProxy

    public static Object getTargetFromProxy(SessionFactoryImplementor sessionFactoryImplementor,
                                            HibernateProxy proxy)

### getTargetClassIfProxied

    public static <T> Class<T> getTargetClassIfProxied(Class<T> clazz)

  Type Parameters:
    `T` - Class type.
  Parameters:
    `clazz` - Class wrapped with a proxy or not.
  Returns:
    Returns target class in case it has been wrapped with a proxy. If `null` reference is passed, method returns `null`.

### objectsEqual

    public static boolean objectsEqual(Object obj1,
                                       Object obj2)

### arraysEqual

    public static boolean arraysEqual(Object[] array1,
                                      Object[] array2)

### iteratorToList

    public static <T> List<T> iteratorToList(Iterator<T> iter)

### iteratorsContentEqual

    public static boolean iteratorsContentEqual(Iterator iter1,
                                                Iterator iter2)

### listToIndexElementPairList

    public static <T> List<Pair<Integer,T>> listToIndexElementPairList(List<T> list)

  Transforms a list of arbitrary elements to a list of index-element pairs.

  Parameters:
    `list` - List to transform.
  Returns:
    A list of pairs: ((0, element_at_index_0), (1, element_at_index_1), ...)

### getProperty

    public static String getProperty(Properties properties,
                                     String propertyName,
                                     String legacyPropertyName,
                                     String defaultValue)

  Parameters:
    `properties` - Properties from which to read.
    `propertyName` - The name of the property.
    `legacyPropertyName` - Legacy name of the property. The value of this property is read if value for `propertyName` is not set.
    `defaultValue` - Default value returned if a value neither for `propertyName` or `legacyPropertyName` is set.
  Returns:
    The value of the property, legacy proparty or the default value, if neither of the values are not set.

### getEntityClass

    public static Class getEntityClass(SessionImplementor sessionImplementor,
                                       Session session,
                                       String entityName)

  Returns:
    Java class mapped to specified entity name.

### mapToArray

    public static Object[] mapToArray(Map<String,Object> data,
                                      String[] keys)

  Converts map's value set to an array. `keys` parameter specifies requested elements and their order.

  Parameters:
    `data` - Source map.
    `keys` - Array of keys that represent requested map values.
  Returns:
    Array of values stored in the map under specified keys. If map does not contain requested key, `null` is inserted.

### getProperty

    public static org.hibernate.annotations.common.reflection.XProperty getProperty(org.hibernate.annotations.common.reflection.XClass clazz,
                                                                                    String propertyName)

  Parameters:
    `clazz` - Source class.
    `propertyName` - Property name.
  Returns:
    Property object or `null` if none with expected name has been found.

### getProperty

    public static org.hibernate.annotations.common.reflection.XProperty getProperty(org.hibernate.annotations.common.reflection.XClass clazz,
                                                                                    String propertyName,
                                                                                    String accessType)

  Parameters:
    `clazz` - Source class.
    `propertyName` - Property name.
    `accessType` - Expected access type. Legal values are field and property.
  Returns:
    Property object or `null` if none with expected name and access type has been found.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.