public class Tools extends Object
Constructor and Description |
---|
Tools() |
Modifier and Type | Method and Description |
---|---|
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 XProperty |
getProperty(XClass clazz,
String propertyName) |
static XProperty |
getProperty(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) |
public static <K,V> Map<K,V> newHashMap()
public static <E> Set<E> newHashSet()
public static <K,V> Map<K,V> newLinkedHashMap()
public static boolean entitiesEqual(SessionImplementor session, String entityName, Object obj1, Object obj2)
public static Object getIdentifier(SessionImplementor session, String entityName, Object obj)
public static Object getTargetFromProxy(SessionFactoryImplementor sessionFactoryImplementor, HibernateProxy proxy)
public static <T> Class<T> getTargetClassIfProxied(Class<T> clazz)
T
- Class type.clazz
- Class wrapped with a proxy or not.null
reference is passed,
method returns null
.public static <T> List<Pair<Integer,T>> listToIndexElementPairList(List<T> list)
list
- List to transform.public static String getProperty(Properties properties, String propertyName, String legacyPropertyName, String defaultValue)
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.public static Class getEntityClass(SessionImplementor sessionImplementor, Session session, String entityName)
public static Object[] mapToArray(Map<String,Object> data, String[] keys)
keys
parameter specifies requested elements and their order.data
- Source map.keys
- Array of keys that represent requested map values.null
is inserted.public static XProperty getProperty(XClass clazz, String propertyName)
clazz
- Source class.propertyName
- Property name.null
if none with expected name has been found.public static XProperty getProperty(XClass clazz, String propertyName, String accessType)
clazz
- Source class.propertyName
- Property name.accessType
- Expected access type. Legal values are field and property.null
if none with expected name and access type has been found.Copyright © 2018 JBoss by Red Hat. All rights reserved.