Class Safely

java.lang.Object
de.uplanet.scripting.groovy.util.Safely

@Scriptable public final class Safely extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    close(T p_closee)
    Safely close an object that has a public close() method.
    static <T> T
    close(T p_closee, org.slf4j.Logger p_log)
    Safely close an object that has a public close() method.
    static void
    Safely call commit on a database connection.
    static void
    commit(Connection p_conn, org.slf4j.Logger p_log)
    Safely call commit on a database connection.
    static void
    Safely call rollback on a database connection.
    static void
    rollback(Connection p_conn, org.slf4j.Logger p_log)
    Safely call rollback on a database connection.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Safely

      public Safely()
  • Method Details

    • close

      public static <T> T close(T p_closee) throws NoSuchMethodException, IllegalAccessException
      Safely close an object that has a public close() method.
      Parameters:
      p_closee - The object be closed or null.
      Returns:
      null.
      Throws:
      NoSuchMethodException - If the given object does not have a public close() method.
      IllegalAccessException
    • close

      public static <T> T close(T p_closee, org.slf4j.Logger p_log) throws NoSuchMethodException, IllegalAccessException
      Safely close an object that has a public close() method.
      Parameters:
      p_closee - The object be closed or null.
      p_log - The logging object used.
      Returns:
      null.
      Throws:
      NoSuchMethodException - If the given object does not have a public close() method.
      IllegalAccessException
    • commit

      public static void commit(Connection p_conn)
      Safely call commit on a database connection.
      Parameters:
      p_conn - The connection to commit.
    • commit

      public static void commit(Connection p_conn, org.slf4j.Logger p_log)
      Safely call commit on a database connection.
      Parameters:
      p_conn - The connection to commit.
      p_log - The logging object used.
    • rollback

      public static void rollback(Connection p_conn)
      Safely call rollback on a database connection.
      Parameters:
      p_conn - The connection to rollback.
    • rollback

      public static void rollback(Connection p_conn, org.slf4j.Logger p_log)
      Safely call rollback on a database connection.
      Parameters:
      p_conn - The connection to rollback.
      p_log - The logging object used.