org.codehaus.mojo.hibernate3
Class HibernateUtils

java.lang.Object
  extended by org.codehaus.mojo.hibernate3.HibernateUtils

public final class HibernateUtils
extends Object

Utility class.

Version:
$Id: HibernateUtils.java 6588 2008-03-28 12:22:57Z bentmann $
Author:
Johann Reyes

Constructor Summary
HibernateUtils()
           
 
Method Summary
static Object getClass(String className)
          Returns an instance of a class or else return a null.
static Object getClass(String className, Class caller)
           
static Object getClass(String className, String defaultClassName)
          Returns an instance of a class or if not found a default one.
static File getFile(File path, String filePath)
          Returns a File object if the file exists and is a file or a null if it doesn't meet the criteria.
static String getJavaVersion()
          Returns "1.5" if the java.version system property starts with 1.5 or 1.6.
static String getPath(File path, String filePath)
          Returns a path of *only* of a file that exists.
static File prepareDirectory(File directory, String parameter)
          Checks if the directory is in fact a directory path and creates it if it is necessary.
static File prepareDirectory(File parent, String directoryPath, String parameter)
          Checks if the directory is in fact a directory path and creates it if it is necessary.
static File prepareFile(File parent, String filePath, String parameter)
          Checks if the file is a file path and creates the directories needed to create the file if it is necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUtils

public HibernateUtils()
Method Detail

getJavaVersion

public static String getJavaVersion()
Returns "1.5" if the java.version system property starts with 1.5 or 1.6. Otherwise returns "1.4".

Returns:
String

getClass

public static Object getClass(String className,
                              String defaultClassName)
Returns an instance of a class or if not found a default one.

Parameters:
className - class to look for
defaultClassName - default class to return
Returns:
Object

getClass

public static Object getClass(String className)
Returns an instance of a class or else return a null.

Parameters:
className - class to return
Returns:
Object

getClass

public static Object getClass(String className,
                              Class caller)

getFile

public static File getFile(File path,
                           String filePath)
Returns a File object if the file exists and is a file or a null if it doesn't meet the criteria.

Parameters:
path - parent path
filePath - file path
Returns:
File object if is a valid file or null if it isn't

getPath

public static String getPath(File path,
                             String filePath)
Returns a path of *only* of a file that exists.

Parameters:
path - parent path
filePath - file path
Returns:
Path to the file

prepareDirectory

public static File prepareDirectory(File parent,
                                    String directoryPath,
                                    String parameter)
                             throws MojoExecutionException
Checks if the directory is in fact a directory path and creates it if it is necessary.

Parameters:
parent - parent file
directoryPath - child directory path
parameter - name of the parameter calling this method
Returns:
the directory as a File object
Throws:
MojoExecutionException - if the directory is not a directory

prepareDirectory

public static File prepareDirectory(File directory,
                                    String parameter)
                             throws MojoExecutionException
Checks if the directory is in fact a directory path and creates it if it is necessary.

Parameters:
directory - child directory
parameter - name of the parameter calling this method
Returns:
the directory as a File object
Throws:
MojoExecutionException - if the directory is not a directory

prepareFile

public static File prepareFile(File parent,
                               String filePath,
                               String parameter)
                        throws MojoExecutionException
Checks if the file is a file path and creates the directories needed to create the file if it is necessary.

Parameters:
parent - parent file
filePath - child file path
parameter - name of the parameter calling this method
Returns:
the file as a File object
Throws:
MojoExecutionException - if the file is not a file


Copyright © 2005-2010 Codehaus. All Rights Reserved.