public final class Common extends Object
Constructor and Description |
---|
Common() |
Modifier and Type | Method and Description |
---|---|
static void |
closeQuietly(Connection connection)
Deprecated.
|
static void |
closeQuietly(ResultSet resultSet)
Deprecated.
|
static void |
closeQuietly(Statement statement)
Deprecated.
|
static String |
convert(FieldNameConverter fnc,
String column) |
static String |
convertDowncaseName(String name) |
static String |
convertSimpleClassName(String name) |
static <T extends RawEntity<K>,K> |
createPeer(EntityManager manager,
Class<T> type,
K key) |
static boolean |
fuzzyCompare(TypeManager typeManager,
Object a,
Object b) |
static boolean |
fuzzyTypeCompare(int typeA,
int typeB) |
static AnnotationDelegate |
getAnnotationDelegate(FieldNameConverter converter,
Method method)
Deprecated.
All annotation information should be resolved upfront using
EntityInfo |
static Class<?> |
getAttributeTypeFromMethod(Method method) |
static String |
getCallingClassName(int depth) |
static String[] |
getMappingFields(FieldNameConverter converter,
Class<? extends RawEntity<?>> from,
Class<? extends RawEntity<?>> to)
Deprecated.
|
static String[] |
getPolymorphicFieldNames(FieldNameConverter converter,
Class<? extends RawEntity<?>> from,
Class<? extends RawEntity<?>> to)
Deprecated.
|
static <K> Class<K> |
getPrimaryKeyClassType(Class<? extends RawEntity<K>> type) |
static String |
getPrimaryKeyField(Class<? extends RawEntity<?>> type,
FieldNameConverter converter) |
static <K> TypeInfo<K> |
getPrimaryKeyType(TypeManager typeManager,
Class<? extends RawEntity<K>> type) |
static <K> K |
getPrimaryKeyValue(RawEntity<K> entity) |
static List<String> |
getSearchableFields(EntityManager manager,
Class<? extends RawEntity<?>> type) |
static Set<Method> |
getValueFieldsMethods(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<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(Method method) |
static boolean |
isAnnotatedAsRelational(Method method) |
static boolean |
isAnnotatedMutator(Method method) |
static boolean |
isMutator(Method method) |
static boolean |
isMutatorOrAccessor(Method method) |
static String |
prefix(String string,
int length)
Extracts a part of the string that remains unchanged during shortening process.
|
static List<String> |
preloadValue(Preload preload,
FieldNameConverter fnc) |
static String |
shorten(String string,
int length)
Shortens a string to the given length if necessary.
|
static <K> void |
validatePrimaryKey(FieldInfo<K> primaryKeyInfo,
Object value) |
static String |
where(ManyToMany manyToMany,
FieldNameConverter fnc) |
static String |
where(OneToMany oneToMany,
FieldNameConverter fnc) |
static String |
where(OneToOne oneToOne,
FieldNameConverter fnc) |
public static <T extends RawEntity<K>,K> T createPeer(EntityManager manager, Class<T> type, K key) throws SQLException
SQLException
@Deprecated public static String[] getMappingFields(FieldNameConverter converter, Class<? extends RawEntity<?>> from, Class<? extends RawEntity<?>> to)
@Deprecated public static String[] getPolymorphicFieldNames(FieldNameConverter converter, Class<? extends RawEntity<?>> from, Class<? extends RawEntity<?>> to)
@Deprecated public static AnnotationDelegate getAnnotationDelegate(FieldNameConverter converter, Method method)
EntityInfo
AnnotationDelegate
objects. Need to
do some research to determine whether or not this is actually
a problem.public static boolean isMutator(Method method)
public static boolean isAnnotatedMutator(Method method)
public static boolean isAccessor(Method method)
public static boolean isMutatorOrAccessor(Method method)
public static boolean isAnnotatedAsRelational(Method method)
public static String getCallingClassName(int depth)
public static List<String> getSearchableFields(EntityManager manager, Class<? extends RawEntity<?>> type)
public static String getPrimaryKeyField(Class<? extends RawEntity<?>> type, FieldNameConverter converter)
public static <K> TypeInfo<K> getPrimaryKeyType(TypeManager typeManager, Class<? extends RawEntity<K>> type)
public static <K> Class<K> getPrimaryKeyClassType(Class<? extends RawEntity<K>> type)
public static <K> K getPrimaryKeyValue(RawEntity<K> entity)
public static <K> void validatePrimaryKey(FieldInfo<K> primaryKeyInfo, Object value)
public static boolean fuzzyCompare(TypeManager typeManager, Object a, Object b)
public static boolean fuzzyTypeCompare(int typeA, int typeB)
public static Set<Method> getValueFieldsMethods(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<String> getValueFieldsNames(EntityInfo<? extends RawEntity<?>,?> entityInfo, FieldNameConverter converter)
entityInfo
- the entity to look up the methods frompublic static List<String> preloadValue(Preload preload, FieldNameConverter fnc)
public static String where(OneToOne oneToOne, FieldNameConverter fnc)
public static String where(OneToMany oneToMany, FieldNameConverter fnc)
public static String where(ManyToMany manyToMany, FieldNameConverter fnc)
public static String convert(FieldNameConverter fnc, String column)
@Deprecated public static void closeQuietly(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(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(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 String shorten(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 String prefix(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–2022 Atlassian. All rights reserved.