ProgramixGenericLib v5.0.1

com.programix.da2
Class DATools

java.lang.Object
  extended by com.programix.da2.DATools

public class DATools
extends Object

Contains various tools helpful in the work of the "data access layer".

Author:
Paul Hyde

Method Summary
static DAException chainWithPrefix(String msg, Throwable cause)
          Returns a new DAException with that has the specified cause chained to it and a message the starts with the specified prefix and ends with the message from the cause.
static void checkType(Class<? extends GenericDA> daInterfaceType, GenericDA daImplementation)
           
static void checkType(Class<? extends GenericDA> daInterfaceType, GenericDA daImplementation, String exceptionPrefix)
           
static DAException convert(Throwable x)
          Takes the specified Throwable and wraps it in a DAException (if necessary).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convert

public static DAException convert(Throwable x)
Takes the specified Throwable and wraps it in a DAException (if necessary). If the type passed in is already a DAException then that exception is simply returned. This is useful in coding situations where only a DAException is allowed to be thrown (and we don't want to wrap a DAException within a DAException):
 public String getSomething(int id) throws DAException {
     try {
         //...

     } catch ( Exception x ) {
         throw DATools.convert(x);
     }
 }
 


chainWithPrefix

public static DAException chainWithPrefix(String msg,
                                          Throwable cause)
Returns a new DAException with that has the specified cause chained to it and a message the starts with the specified prefix and ends with the message from the cause.


checkType

public static void checkType(Class<? extends GenericDA> daInterfaceType,
                             GenericDA daImplementation,
                             String exceptionPrefix)
                      throws DAException
Throws:
DAException

checkType

public static void checkType(Class<? extends GenericDA> daInterfaceType,
                             GenericDA daImplementation)
                      throws DAException
Throws:
DAException

ProgramixGenericLib v5.0.1

Copyright © 2001-2009 Programix Incorporated. All rights reserved. ProgramixGenericLib is free and is OSI Certified Open Source Software under the BSD license.