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)
          Closes the Connection in a null safe manner and quietly, i.e without throwing nor logging any exception
static void closeQuietly(ResultSet resultSet)
          Closes the ResultSet in a null safe manner and quietly, i.e without throwing nor logging any exception
static void closeQuietly(Statement statement)
          Closes the Statement in a null safe manner and quietly, i.e without throwing nor logging any exception
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 Method findCounterpart(FieldNameConverter converter, Method method)
          Finds the corresponding method in an accessor/mutator pair based on the given method (or null if no corresponding method).
static boolean fuzzyCompare(Object a, Object b)
           
static boolean fuzzyTypeCompare(int typeA, int typeB)
           
static AnnotationDelegate getAnnotationDelegate(FieldNameConverter converter, Method method)
          Note: this method leads to the creation and quick discard of large numbers of AnnotationDelegate objects.
static Class<?> getAttributeTypeFromMethod(Method method)
           
static Class<?> getCallingClass(int depth)
           
static String[] getMappingFields(FieldNameConverter converter, Class<? extends RawEntity<?>> from, Class<? extends RawEntity<?>> to)
           
static String[] getPolymorphicFieldNames(FieldNameConverter converter, Class<? extends RawEntity<?>> from, Class<? extends RawEntity<?>> to)
           
static Method getPrimaryKeyAccessor(Class<? extends RawEntity<?>> type)
           
static
<K> Class<K>
getPrimaryKeyClassType(Class<? extends RawEntity<K>> type)
           
static String getPrimaryKeyField(Class<? extends RawEntity<?>> type, FieldNameConverter converter)
           
static Method getPrimaryKeyMethod(Class<? extends RawEntity<?>> type)
           
static
<K> DatabaseType<K>
getPrimaryKeyType(Class<? extends RawEntity<K>> type)
           
static
<K> K
getPrimaryKeyValue(RawEntity<K> entity)
           
static List<String> getSearchableFields(EntityManager manager, Class<? extends RawEntity<?>> type)
           
static boolean interfaceInheritsFrom(Class<?> type, Class<?> superType)
           
static boolean isAccessor(Method method)
           
static boolean isMutator(Method method)
           
static boolean typeInstanceOf(Class<?> type, Class<?> otherType)
           
 
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)

convertSimpleClassName

public static String convertSimpleClassName(String name)

convertDowncaseName

public static String convertDowncaseName(String name)

interfaceInheritsFrom

public static boolean interfaceInheritsFrom(Class<?> type,
                                            Class<?> superType)

typeInstanceOf

public static boolean typeInstanceOf(Class<?> type,
                                     Class<?> otherType)

getMappingFields

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

getPolymorphicFieldNames

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

getAnnotationDelegate

public static AnnotationDelegate getAnnotationDelegate(FieldNameConverter converter,
                                                       Method method)
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.


findCounterpart

public static Method findCounterpart(FieldNameConverter converter,
                                     Method method)
Finds the corresponding method in an accessor/mutator pair based on the given method (or null if no corresponding method).

Parameters:
converter - TODO

isAccessor

public static boolean isAccessor(Method method)

isMutator

public static boolean isMutator(Method method)

getAttributeTypeFromMethod

public static Class<?> getAttributeTypeFromMethod(Method method)

getCallingClass

public static Class<?> getCallingClass(int depth)

getSearchableFields

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

getPrimaryKeyAccessor

public static Method getPrimaryKeyAccessor(Class<? extends RawEntity<?>> type)

getPrimaryKeyField

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

getPrimaryKeyMethod

public static Method getPrimaryKeyMethod(Class<? extends RawEntity<?>> type)

getPrimaryKeyType

public static <K> DatabaseType<K> getPrimaryKeyType(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)

fuzzyCompare

public static boolean fuzzyCompare(Object a,
                                   Object b)

fuzzyTypeCompare

public static boolean fuzzyTypeCompare(int typeA,
                                       int typeB)

closeQuietly

public static void closeQuietly(ResultSet resultSet)
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

public static void closeQuietly(Statement statement)
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

public static void closeQuietly(Connection connection)
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


Copyright © 2007-2011. All Rights Reserved.