org.hibernate.envers.tools
Class Tools

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

public class Tools
extends Object

Author:
Adam Warski (adam at warski dot org), Hern´┐Żn Chanfreau

Constructor Summary
Tools()
           
 
Method Summary
static boolean entitiesEqual(SessionImplementor session, String entityName, Object obj1, Object obj2)
           
static Object getIdentifier(SessionImplementor session, String entityName, Object obj)
           
static String getProperty(Properties properties, String propertyName, String legacyPropertyName, String defaultValue)
           
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
<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)

objectsEqual

public static boolean objectsEqual(Object obj1,
                                   Object obj2)

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.


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