net.java.ao
Class Common

java.lang.Object
  extended by net.java.ao.Common

public final class Common
extends Object

WARNING: Not part of the public API. This class is public only to allow its use within other packages in the ActiveObjects library.

Author:
Daniel Spiewak

Constructor Summary
Common()
           
 
Method Summary
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>
T
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 Set<String> getValueFieldsNames(Class<? extends RawEntity<?>> entity, FieldNameConverter converter)
           
static boolean isAccessor(Method method)
           
static boolean isAnnotatedAsRelational(Method method)
           
static boolean isAnnotatedMutator(Method method)
           
static boolean isMutator(Method method)
           
static List<String> preloadValue(Preload preload, FieldNameConverter fnc)
           
static String shorten(String s, 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Common

public Common()
Method Detail

createPeer

public static <T extends RawEntity<K>,K> T createPeer(EntityManager manager,
                                                      Class<T> type,
                                                      K key)
                                         throws SQLException
Throws:
SQLException

convertSimpleClassName

public static String convertSimpleClassName(String name)

convertDowncaseName

public static String convertDowncaseName(String name)

getMappingFields

@Deprecated
public static String[] getMappingFields(FieldNameConverter converter,
                                                   Class<? extends RawEntity<?>> from,
                                                   Class<? extends RawEntity<?>> to)
Deprecated. 

See Also:
AO-325

getPolymorphicFieldNames

@Deprecated
public static String[] getPolymorphicFieldNames(FieldNameConverter converter,
                                                           Class<? extends RawEntity<?>> from,
                                                           Class<? extends RawEntity<?>> to)
Deprecated. 

See Also:
AO-325

getAnnotationDelegate

@Deprecated
public static AnnotationDelegate getAnnotationDelegate(FieldNameConverter converter,
                                                                  Method method)
Deprecated. All annotation information should be resolved upfront using EntityInfo

Note: this method leads to the creation and quick discard of large numbers of AnnotationDelegate objects. Need to do some research to determine whether or not this is actually a problem.


isMutator

public static boolean isMutator(Method method)

isAnnotatedMutator

public static boolean isAnnotatedMutator(Method method)

isAccessor

public static boolean isAccessor(Method method)

isAnnotatedAsRelational

public static boolean isAnnotatedAsRelational(Method method)

getAttributeTypeFromMethod

public static Class<?> getAttributeTypeFromMethod(Method method)

getCallingClassName

public static String getCallingClassName(int depth)

getSearchableFields

public static List<String> getSearchableFields(EntityManager manager,
                                               Class<? extends RawEntity<?>> type)

getPrimaryKeyField

public static String getPrimaryKeyField(Class<? extends RawEntity<?>> type,
                                        FieldNameConverter converter)

getPrimaryKeyType

public static <K> TypeInfo<K> getPrimaryKeyType(TypeManager typeManager,
                                                Class<? extends RawEntity<K>> type)

getPrimaryKeyClassType

public static <K> Class<K> getPrimaryKeyClassType(Class<? extends RawEntity<K>> type)

getPrimaryKeyValue

public static <K> K getPrimaryKeyValue(RawEntity<K> entity)

validatePrimaryKey

public static <K> void validatePrimaryKey(FieldInfo<K> primaryKeyInfo,
                                          Object value)

fuzzyCompare

public static boolean fuzzyCompare(TypeManager typeManager,
                                   Object a,
                                   Object b)

fuzzyTypeCompare

public static boolean fuzzyTypeCompare(int typeA,
                                       int typeB)

getValueFieldsMethods

public static Set<Method> getValueFieldsMethods(Class<? extends RawEntity<?>> entity,
                                                FieldNameConverter converter)
Gets all the methods of an entity that correspond to a value field. This means fields that are stored as values in the database as opposed to fields (IDs) that define a relationship to another table in the database.

Parameters:
entity - the entity to look up the methods from
converter - the field name converter currently in use for entities
Returns:
the set of method found

getValueFieldsNames

public static Set<String> getValueFieldsNames(Class<? extends RawEntity<?>> entity,
                                              FieldNameConverter converter)

preloadValue

public static List<String> preloadValue(Preload preload,
                                        FieldNameConverter fnc)

where

public static String where(OneToOne oneToOne,
                           FieldNameConverter fnc)

where

public static String where(OneToMany oneToMany,
                           FieldNameConverter fnc)

where

public static String where(ManyToMany manyToMany,
                           FieldNameConverter fnc)

convert

public static String convert(FieldNameConverter fnc,
                             String column)

closeQuietly

@Deprecated
public static void closeQuietly(ResultSet resultSet)
Deprecated. 

Closes the ResultSet in a null safe manner and quietly, i.e without throwing nor logging any exception

Parameters:
resultSet - the result set to close

closeQuietly

@Deprecated
public static void closeQuietly(Statement statement)
Deprecated. 

Closes the Statement in a null safe manner and quietly, i.e without throwing nor logging any exception

Parameters:
statement - the statement to close

closeQuietly

@Deprecated
public static void closeQuietly(Connection connection)
Deprecated. 

Closes the Connection in a null safe manner and quietly, i.e without throwing nor logging any exception

Parameters:
connection - the connection to close, can be null

shorten

public static String shorten(String s,
                             int length)
Shortens a String to the given length if necessary. The process of shortening is stable.



Copyright © 2007-2013. All Rights Reserved.