public final class TemplateUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static Object |
callMethod(Template template,
TemplateContext context,
Object object,
String methodName,
Object... parameters)
进行方法调用
|
static void |
dent(TemplateContext context) |
static String |
escapeHtml(Object object)
进行Html转义
|
static Object |
executeClassMethod(Object object,
String methodName,
Object[] parameters) |
static Object |
getArrayValue(Object object,
Object indexObject) |
static Object |
getAttribute(Object object,
Object name)
获取属性
|
static String |
getBlanks(TemplateContext context) |
static boolean |
getBooleanValue(Object object)
判断布尔值是否成立
|
static String |
getI18n(I18nVisitor i18nVistor,
TemplateContext context,
String key)
获取
|
static String |
getLocalePath(String path,
Locale locale)
返回国际化资源的路径
|
static Class<?>[] |
getParameterTypes(Class clazz,
String methodName) |
static String |
getPath(String currentPath,
String newPath)
根据当前路径,计算新路径的绝对路径
|
static Object |
getSafeArrayValue(Object object,
Object indexObject)
访问数组类型的内容
|
static Object |
getValueFromBean(Object key)
从Bean容器获得对应的值
|
static Object |
getValueFromContext(Context context,
Object key)
从上下文获取对应标识的值
|
static Object |
getVariableValue(Context context,
Object key)
获得标识变量的值
|
static void |
indent(TemplateContext context) |
static boolean |
isSafeVariable() |
static Object |
safeCallMethod(Template template,
TemplateContext context,
Object object,
String methodName,
Object... parameters)
安全方法调用
|
static void |
setSafeVariable(boolean safeVariable) |
static Object |
sp(Object object,
Object name) |
static String |
trimEnd(String str,
String[] stripChars)
除去字符串尾部的指定字符
|
static String |
trimStart(String str,
String[] stripChars)
除去字符串头部的指定字符
|
public static boolean isSafeVariable()
public static void setSafeVariable(boolean safeVariable)
public static Object getAttribute(Object object, Object name) throws TemplateException
object - name - TemplateExceptionpublic static Object sp(Object object, Object name) throws TemplateException
TemplateExceptionpublic static String getI18n(I18nVisitor i18nVistor, TemplateContext context, String key)
i18nVistor - key - public static Object callMethod(Template template, TemplateContext context, Object object, String methodName, Object... parameters) throws TemplateException
object - methodName - parameters - TemplateExceptionpublic static Object executeClassMethod(Object object, String methodName, Object[] parameters) throws Exception
Exceptionpublic static Object safeCallMethod(Template template, TemplateContext context, Object object, String methodName, Object... parameters) throws TemplateException
object - methodName - parameters - TemplateExceptionpublic static Class<?>[] getParameterTypes(Class clazz, String methodName) throws TemplateException
TemplateExceptionpublic static Object getValueFromContext(Context context, Object key)
context - key - public static Object getValueFromBean(Object key)
key - public static Object getVariableValue(Context context, Object key)
context - key - public static String getPath(String currentPath, String newPath)
currentPath - newPath - public static void dent(TemplateContext context)
public static void indent(TemplateContext context)
public static String getBlanks(TemplateContext context)
public static boolean getBooleanValue(Object object)
object - public static Object getSafeArrayValue(Object object, Object indexObject) throws TemplateException
object - indexObject - 索引值ExceptionTemplateExceptionpublic static Object getArrayValue(Object object, Object indexObject) throws TemplateException
TemplateExceptionpublic static String getLocalePath(String path, Locale locale)
path - locale - public static String trimStart(String str, String[] stripChars)
str - 要处理的字符串stripChars - 要除去的字符数组,如果为null表示除去空白字符Copyright © 2006–2018 TinyGroup. All rights reserved.