net.sf.fikin.pojostate.select
Class Tools

java.lang.Object
  extended by net.sf.fikin.pojostate.select.Tools

public class Tools
extends java.lang.Object

Various in its purpose algorithms, used here and there created on Mar 2, 2007

Since:
Version:
$Revision: 1.2 $
Author:
fiykov

Constructor Summary
Tools()
           
 
Method Summary
static java.lang.String getResouceBundleStringNvl(java.util.ResourceBundle bundle, java.lang.String key)
          essentially same as bundle.getString(key) but catches all exceptions and return null instead
static boolean isGetterMethod(java.lang.Class clazz, java.lang.reflect.Method method, boolean filterObject)
          test if given method is Bean getter
static java.text.Format newFormatter(java.lang.String txt, java.util.Locale locale, java.lang.ClassLoader loader)
          instantiates new Format object out of description in the format:
"class[;format mask]" where "[" and "]" denote that the part is optional.
static java.lang.String[] splitValue(java.lang.String txt)
          split the value into "first;second" where ";" is first leftmost occurrence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tools

public Tools()
Method Detail

newFormatter

public static java.text.Format newFormatter(java.lang.String txt,
                                            java.util.Locale locale,
                                            java.lang.ClassLoader loader)
                                     throws java.lang.IllegalArgumentException
instantiates new Format object out of description in the format:
"class[;format mask]" where "[" and "]" denote that the part is optional.

Parameters:
txt - is in the format "fq class name[;format mask]"
locale - is passed to the format object (constructor), if such constructor exists of course.
loader - is the classloader used to instantiate the new format object
Returns:
java.text.Format object
Throws:
java.lang.IllegalArgumentException

splitValue

public static java.lang.String[] splitValue(java.lang.String txt)
split the value into "first;second" where ";" is first leftmost occurrence

Parameters:
txt - to split
Returns:
an array of String objects, after the text splitting

getResouceBundleStringNvl

public static java.lang.String getResouceBundleStringNvl(java.util.ResourceBundle bundle,
                                                         java.lang.String key)
essentially same as bundle.getString(key) but catches all exceptions and return null instead

Parameters:
bundle - to be looked for the value
key - to be used to look in the bundle for value
Returns:
the value if exists and it is string, all other cases result in null

isGetterMethod

public static boolean isGetterMethod(java.lang.Class clazz,
                                     java.lang.reflect.Method method,
                                     boolean filterObject)
test if given method is Bean getter

Parameters:
clazz - is POJO's class
method - is some of the clazz methods, currently being tested if it is to be observed
filterObject - is filter out from the checking java.lang.Object methods if this is set to true
Returns:
true if it is bean getter method, otherwise false


Copyright © 2005 Nikolay Fiykov. All Rights Reserved.