net.java.ao
Class Common

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

public final class Common
extends java.lang.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(java.sql.Connection connection)
          Closes the Connection in a null safe manner and quietly, i.e without throwing nor logging any exception
static void closeQuietly(java.sql.ResultSet resultSet)
          Closes the ResultSet in a null safe manner and quietly, i.e without throwing nor logging any exception
static void closeQuietly(java.sql.Statement statement)
          Closes the Statement in a null safe manner and quietly, i.e without throwing nor logging any exception
static java.lang.String convertDowncaseName(java.lang.String name)
           
static java.lang.String convertSimpleClassName(java.lang.String name)
           
static
<T extends RawEntity<K>,K>
T
createPeer(EntityManager manager, java.lang.Class<T> type, K key)
           
static java.lang.reflect.Method findCounterpart(FieldNameConverter converter, java.lang.reflect.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(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)
          Note: this method leads to the creation and quick discard of large numbers of AnnotationDelegate objects.
static java.lang.Class<?> getAttributeTypeFromMethod(java.lang.reflect.Method method)
           
static java.lang.Class<?> getCallingClass(int depth)
           
static java.lang.String[] getMappingFields(FieldNameConverter converter, java.lang.Class<? extends RawEntity<?>> from, java.lang.Class<? extends RawEntity<?>> to)
           
static java.lang.String[] getPolymorphicFieldNames(FieldNameConverter converter, java.lang.Class<? extends RawEntity<?>> from, java.lang.Class<? extends RawEntity<?>> to)
           
static java.lang.reflect.Method getPrimaryKeyAccessor(java.lang.Class<? extends RawEntity<?>> type)
           
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 java.lang.reflect.Method getPrimaryKeyMethod(java.lang.Class<? extends RawEntity<?>> type)
           
static
<K> DatabaseType<K>
getPrimaryKeyType(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 boolean interfaceInheritsFrom(java.lang.Class<?> type, java.lang.Class<?> superType)
           
static boolean isAccessor(java.lang.reflect.Method method)
           
static boolean isMutator(java.lang.reflect.Method method)
           
static boolean typeInstanceOf(java.lang.Class<?> type, java.lang.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,
                                                      java.lang.Class<T> type,
                                                      K key)

convertSimpleClassName

public static java.lang.String convertSimpleClassName(java.lang.String name)

convertDowncaseName

public static java.lang.String convertDowncaseName(java.lang.String name)

interfaceInheritsFrom

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

typeInstanceOf

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

getMappingFields

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

getPolymorphicFieldNames

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

getAnnotationDelegate

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

isMutator

public static boolean isMutator(java.lang.reflect.Method method)

getAttributeTypeFromMethod

public static java.lang.Class<?> getAttributeTypeFromMethod(java.lang.reflect.Method method)

getCallingClass

public static java.lang.Class<?> getCallingClass(int depth)

getSearchableFields

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

getPrimaryKeyAccessor

public static java.lang.reflect.Method getPrimaryKeyAccessor(java.lang.Class<? extends RawEntity<?>> type)

getPrimaryKeyField

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

getPrimaryKeyMethod

public static java.lang.reflect.Method getPrimaryKeyMethod(java.lang.Class<? extends RawEntity<?>> type)

getPrimaryKeyType

public static <K> DatabaseType<K> getPrimaryKeyType(java.lang.Class<? extends RawEntity<K>> type)

getPrimaryKeyClassType

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

getPrimaryKeyValue

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

fuzzyCompare

public static boolean fuzzyCompare(java.lang.Object a,
                                   java.lang.Object b)

fuzzyTypeCompare

public static boolean fuzzyTypeCompare(int typeA,
                                       int typeB)

closeQuietly

public static void closeQuietly(java.sql.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(java.sql.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(java.sql.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-2010. All Rights Reserved.