olg.csv.bean
Class Util

Package class diagram package Util
java.lang.Object
  extended by olg.csv.bean.Util

public final class Util
extends Object

Util in loading objects from XML Documents and identifying getter and setter method.


Field Summary
private static org.slf4j.Logger LOGGER
          the class logger.
 
Constructor Summary
private Util()
          private constructor to prevent its instantiation.
 
Method Summary
static boolean asSubClass(Class<?> clazzA, Class<?> clazzB)
          Definie if a class is a subclass of an another class.
static String emptyToNull(String str)
          Convert empty String to null.
static
<T> Method
identifyGetter(Class<T> clazz, String field)
          Returns public getter corresponding to the given field.
static
<T> Method
identifySetter(Class<T> clazz, String field)
          Returns public setter corresponding to the given field.
static
<T> Class<?>
identifySetType(Class<T> clazz, String field)
          Returns Class corresponding to the given field identify by its setter.
static
<T> boolean
isConcrete(Class<T> clazz)
          Returns if a class is concrete and not an enum class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.slf4j.Logger LOGGER
the class logger.

Constructor Detail

Util

private Util()
private constructor to prevent its instantiation.

Method Detail

identifySetType

public static <T> Class<?> identifySetType(Class<T> clazz,
                                           String field)
                                throws NoSuchMethodException
Returns Class corresponding to the given field identify by its setter.

Type Parameters:
T - the type of the class
Parameters:
clazz - class which has the given field
field - field name
Returns:
declared class by the setter as the returned type
Throws:
NoSuchMethodException - if no setter found

identifySetter

public static <T> Method identifySetter(Class<T> clazz,
                                        String field)
Returns public setter corresponding to the given field.

Type Parameters:
T - the type of the class.
Parameters:
clazz - class which has the given field
field - field name
Returns:
null if no public setter found

identifyGetter

public static <T> Method identifyGetter(Class<T> clazz,
                                        String field)
Returns public getter corresponding to the given field.

Type Parameters:
T - the type of the class.
Parameters:
clazz - class which has the given field
field - field name
Returns:
null if no public getter found

emptyToNull

public static String emptyToNull(String str)
Convert empty String to null.

Parameters:
str - String to convert
Returns:
the converted value.

asSubClass

public static boolean asSubClass(Class<?> clazzA,
                                 Class<?> clazzB)
Definie if a class is a subclass of an another class.

Parameters:
clazzA - the class.
clazzB - the subclass candidate.
Returns:
true if clazzB is a subclass of clazzA.

isConcrete

public static <T> boolean isConcrete(Class<T> clazz)
Returns if a class is concrete and not an enum class.

Type Parameters:
T - the type of the class.
Parameters:
clazz - the class.
Returns:
true if the class is concrete.


Copyright © 2014. All Rights Reserved.