public class Utility extends Object
| Constructor and Description |
|---|
Utility() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
DeepCopy(Object orig) |
static <K extends Enum<K>,T extends Annotation> |
enumAnnotations(Class<K> myEnum,
Class<T> annotationClass) |
static <T> T |
enumParser(Class<T> type,
String value)
Case insensitive enum convert
|
static <T> T |
fromByte(byte[] b)
Any object from Bytes, make sure implements Serializable
|
static <T> T |
fromJson(String xmlString,
Class<T> targetClass) |
static <T> T |
fromJson(String jsonString,
Class<T> targetClass,
boolean attributePref) |
static <T> T |
fromXml(String xmlString,
Class<T> targetClass) |
static String |
getStringFromFileUrl(String fileUrl)
read file from either URL or local path,
use StringExtension.IsWellFormedUriString to detector weather URL or not
|
static boolean |
isCustomClass(Object check) |
static <T> T |
jacksonFromJson(String jsonString,
Class<T> parametrizedClass,
Class<?>... parameterClasses) |
static String |
jacksonToJson(Object obj) |
static Document |
parseXmlDom(String xmlStr) |
static String |
parseXmlSax(String xmlStr) |
static <T> T |
ReadContextValue(String configName) |
static Properties |
ReadProperties(String filePath) |
static InputStream |
removeUtf8BOM(InputStream inputStream) |
static String |
removeUtf8BOM(String input) |
static String |
removeXmlDeclaration(String xml) |
static boolean |
stringExpression(Map<String,Object> parameters,
String condition) |
static byte[] |
toByte(Serializable obj)
Any object to Bytes, make sure implements Serializable
|
static <T> String |
toJson(T obj) |
static <T> String |
toJson(T obj,
boolean attributePref) |
static <T> String |
toXml(T obj) |
static String |
xmlNodeToString(Document xmlNode) |
static XsltInfo |
XsltReader(String xsltFilePath) |
static String |
xsltTransformer(String xml,
String xslt,
NameValuePair... paramList) |
static String |
xsltTransformer(String xml,
String xslt,
String xsltLookUpFolder,
NameValuePair... paramList) |
public static byte[] toByte(Serializable obj)
obj - public static <T> T fromByte(byte[] b)
b - public static <T> String toXml(T obj)
public static <T> String toJson(T obj, boolean attributePref)
public static <T> String toJson(T obj)
public static <T> T fromJson(String jsonString, Class<T> targetClass, boolean attributePref)
public static String jacksonToJson(Object obj) throws IOException
IOExceptionpublic static <T> T jacksonFromJson(String jsonString, Class<T> parametrizedClass, Class<?>... parameterClasses) throws IOException
IOExceptionpublic static <T> T DeepCopy(Object orig) throws IOException
IOExceptionpublic static String getStringFromFileUrl(String fileUrl) throws IOException
IOExceptionpublic static String xsltTransformer(String xml, String xslt, NameValuePair... paramList) throws TransformerException
TransformerExceptionpublic static String xsltTransformer(String xml, String xslt, String xsltLookUpFolder, NameValuePair... paramList) throws TransformerException
TransformerExceptionpublic static InputStream removeUtf8BOM(InputStream inputStream) throws IOException
IOExceptionpublic static Document parseXmlDom(String xmlStr) throws ParserConfigurationException, IOException, SAXException
public static String parseXmlSax(String xmlStr) throws SAXException, IOException, ParserConfigurationException
public static String xmlNodeToString(Document xmlNode) throws IOException
IOExceptionpublic static XsltInfo XsltReader(String xsltFilePath) throws Exception
Exceptionpublic static <T> T enumParser(Class<T> type, String value)
Sample:
assert CommandTypeInfo.StoredProcedure == CommandTypeInfo.valueOf("StoredProcedure");
assert CommandTypeInfo.StoredProcedure == Enum.valueOf(CommandTypeInfo.class,"StoredProcedure");
assert CommandTypeInfo.StoredProcedure == Utility.enumParser(CommandTypeInfo.class,"StOredProcedure");
public static <K extends Enum<K>,T extends Annotation> Map<K,T> enumAnnotations(Class<K> myEnum, Class<T> annotationClass) throws Exception
Exceptionpublic static <T> T ReadContextValue(String configName) throws NamingException
NamingExceptionpublic static Properties ReadProperties(String filePath) throws Exception
Exceptionpublic static boolean stringExpression(Map<String,Object> parameters, String condition)
public static boolean isCustomClass(Object check)
Copyright © 2016. All rights reserved.