public final class Common
extends java.lang.Object
Constructor and Description |
---|
Common() |
Modifier and Type | Method and Description |
---|---|
static void |
closeQuietly(java.sql.Connection connection)
Deprecated.
|
static void |
closeQuietly(java.sql.ResultSet resultSet)
Deprecated.
|
static void |
closeQuietly(java.sql.Statement statement)
Deprecated.
|
static java.lang.String |
convert(FieldNameConverter fnc,
java.lang.String column) |
static java.lang.String |
convertDowncaseName(java.lang.String name) |
static java.lang.String |
convertSimpleClassName(java.lang.String name) |
static <T extends RawEntity<K>,K> |
createPeer(EntityManager manager,
java.lang.Class<T> type,
K key) |
static boolean |
fuzzyCompare(TypeManager typeManager,
java.lang.Object a,
java.lang.Object b) |
static boolean |
fuzzyTypeCompare(int typeA,
int typeB) |
static AnnotationDelegate |
getAnnotationDelegate(FieldNameConverter converter,
java.lang.reflect.Method method)
Deprecated.
All annotation information should be resolved upfront using
EntityInfo |
static java.lang.Class<?> |
getAttributeTypeFromMethod(java.lang.reflect.Method method) |
static java.lang.String |
getCallingClassName(int depth) |
static java.lang.String[] |
getMappingFields(FieldNameConverter converter,
java.lang.Class<? extends RawEntity<?>> from,
java.lang.Class<? extends RawEntity<?>> to)
Deprecated.
|
static java.lang.String[] |
getPolymorphicFieldNames(FieldNameConverter converter,
java.lang.Class<? extends RawEntity<?>> from,
java.lang.Class<? extends RawEntity<?>> to)
Deprecated.
|
static <K> java.lang.Class<K> |
getPrimaryKeyClassType(java.lang.Class<? extends RawEntity<K>> type) |
static java.lang.String |
getPrimaryKeyField(java.lang.Class<? extends RawEntity<?>> type,
FieldNameConverter converter) |
static <K> TypeInfo<K> |
getPrimaryKeyType(TypeManager typeManager,
java.lang.Class<? extends RawEntity<K>> type) |
static <K> K |
getPrimaryKeyValue(RawEntity<K> entity) |
static java.util.List<java.lang.String> |
getSearchableFields(EntityManager manager,
java.lang.Class<? extends RawEntity<?>> type) |
static java.util.Set<java.lang.reflect.Method> |
getValueFieldsMethods(java.lang.Class<? extends RawEntity<?>> entity,
FieldNameConverter converter)
Gets all the methods of an entity that correspond to a value field.
|
static com.google.common.collect.ImmutableSet<java.lang.String> |
getValueFieldsNames(EntityInfo<? extends RawEntity<?>,?> entityInfo,
FieldNameConverter converter)
Gets all the names of fields of an entity that correspond to a value field.
|
static boolean |
isAccessor(java.lang.reflect.Method method) |
static boolean |
isAnnotatedAsRelational(java.lang.reflect.Method method) |
static boolean |
isAnnotatedMutator(java.lang.reflect.Method method) |
static boolean |
isMutator(java.lang.reflect.Method method) |
static boolean |
isMutatorOrAccessor(java.lang.reflect.Method method) |
static java.lang.String |
prefix(java.lang.String string,
int length)
Extracts a part of the string that remains unchanged during shortening process.
|
static java.util.List<java.lang.String> |
preloadValue(Preload preload,
FieldNameConverter fnc) |
static java.lang.String |
shorten(java.lang.String string,
int length)
Shortens a string to the given length if necessary.
|
static <K> void |
validatePrimaryKey(FieldInfo<K> primaryKeyInfo,
java.lang.Object value) |
static java.lang.String |
where(ManyToMany manyToMany,
FieldNameConverter fnc) |
static java.lang.String |
where(OneToMany oneToMany,
FieldNameConverter fnc) |
static java.lang.String |
where(OneToOne oneToOne,
FieldNameConverter fnc) |
public static <T extends RawEntity<K>,K> T createPeer(EntityManager manager, java.lang.Class<T> type, K key) throws java.sql.SQLException
java.sql.SQLException
public static java.lang.String convertSimpleClassName(java.lang.String name)
public static java.lang.String convertDowncaseName(java.lang.String name)
@Deprecated public static java.lang.String[] getMappingFields(FieldNameConverter converter, java.lang.Class<? extends RawEntity<?>> from, java.lang.Class<? extends RawEntity<?>> to)
@Deprecated public static java.lang.String[] getPolymorphicFieldNames(FieldNameConverter converter, java.lang.Class<? extends RawEntity<?>> from, java.lang.Class<? extends RawEntity<?>> to)
@Deprecated public static AnnotationDelegate getAnnotationDelegate(FieldNameConverter converter, java.lang.reflect.Method method)
EntityInfo
AnnotationDelegate
objects. Need to
do some research to determine whether or not this is actually
a problem.public static boolean isMutator(java.lang.reflect.Method method)
public static boolean isAnnotatedMutator(java.lang.reflect.Method method)
public static boolean isAccessor(java.lang.reflect.Method method)
public static boolean isMutatorOrAccessor(java.lang.reflect.Method method)
public static boolean isAnnotatedAsRelational(java.lang.reflect.Method method)
public static java.lang.Class<?> getAttributeTypeFromMethod(java.lang.reflect.Method method)
public static java.lang.String getCallingClassName(int depth)
public static java.util.List<java.lang.String> getSearchableFields(EntityManager manager, java.lang.Class<? extends RawEntity<?>> type)
public static java.lang.String getPrimaryKeyField(java.lang.Class<? extends RawEntity<?>> type, FieldNameConverter converter)
public static <K> TypeInfo<K> getPrimaryKeyType(TypeManager typeManager, java.lang.Class<? extends RawEntity<K>> type)
public static <K> java.lang.Class<K> getPrimaryKeyClassType(java.lang.Class<? extends RawEntity<K>> type)
public static <K> K getPrimaryKeyValue(RawEntity<K> entity)
public static <K> void validatePrimaryKey(FieldInfo<K> primaryKeyInfo, java.lang.Object value)
public static boolean fuzzyCompare(TypeManager typeManager, java.lang.Object a, java.lang.Object b)
public static boolean fuzzyTypeCompare(int typeA, int typeB)
public static java.util.Set<java.lang.reflect.Method> getValueFieldsMethods(java.lang.Class<? extends RawEntity<?>> entity, FieldNameConverter converter)
entity
- the entity to look up the methods fromconverter
- the field name converter currently in use for entitiespublic static com.google.common.collect.ImmutableSet<java.lang.String> getValueFieldsNames(EntityInfo<? extends RawEntity<?>,?> entityInfo, FieldNameConverter converter)
entityInfo
- the entity to look up the methods frompublic static java.util.List<java.lang.String> preloadValue(Preload preload, FieldNameConverter fnc)
public static java.lang.String where(OneToOne oneToOne, FieldNameConverter fnc)
public static java.lang.String where(OneToMany oneToMany, FieldNameConverter fnc)
public static java.lang.String where(ManyToMany manyToMany, FieldNameConverter fnc)
public static java.lang.String convert(FieldNameConverter fnc, java.lang.String column)
@Deprecated public static void closeQuietly(java.sql.ResultSet resultSet)
ResultSet
in a null
safe manner and quietly, i.e without throwing nor logging
any exceptionresultSet
- the result set to close@Deprecated public static void closeQuietly(java.sql.Statement statement)
Statement
in a null
safe manner and quietly, i.e without throwing nor logging
any exceptionstatement
- the statement to close@Deprecated public static void closeQuietly(java.sql.Connection connection)
Connection
in a null
safe manner and quietly, i.e without throwing nor logging
any exceptionconnection
- the connection to close, can be null
public static java.lang.String shorten(java.lang.String string, int length)
Strings shorter than length will not be shortened.
For longer strings the first length - length/3 - 1
characters remain unchanged.
The remaining space is filled with string's last length/3
hashCode characters.
string
- to be shortened.length
- to which string will be shortened.public static java.lang.String prefix(java.lang.String string, int length)
For strings shorter than specified length the string itself is returned.
For longer strings the first length - length/3 - 1
characters are returned.
string
- for which the prefix will be extracted.length
- used in shorten(java.lang.String, int)
ing process.shorten(String, int)
Copyright © 2007-2020 Atlassian. All Rights Reserved.