| 限定符和类型 | 字段和说明 |
|---|---|
static String |
TYPE_BIGDECIMAL |
static String |
TYPE_BIGINTEGER |
static String |
TYPE_BOOLEAN |
static String |
TYPE_BYTE |
static String |
TYPE_BYTES |
static String |
TYPE_DATE |
static String |
TYPE_DATETIME |
static String |
TYPE_DOUBLE |
static String |
TYPE_FLOAT |
static String |
TYPE_INT |
static String |
TYPE_INTEGER |
static String |
TYPE_LONG |
static String |
TYPE_OBJECT |
static String |
TYPE_SHORT |
static String |
TYPE_STRING |
static String |
TYPE_TIME |
static String |
VALUE_BLANK |
static String |
VALUE_CURRENT_DATE |
static String |
VALUE_FALSE |
static String |
VALUE_NOW |
static String |
VALUE_ONE |
static String |
VALUE_TRUE |
static String |
VALUE_ZERO |
| 构造器和说明 |
|---|
UtilData() |
| 限定符和类型 | 方法和说明 |
|---|---|
static List<Thing> |
addToSource(List<Thing> source,
List<Thing> forAdd,
boolean strict)
添加指定的事物列表到已有的事物列表中,添加时如果存在第一个的描述者相同且名字相同的则不添加。
|
static List<Thing> |
addToSource(List<Thing> source,
Thing forAdd,
boolean strict)
添加指定的事物到源事物列表中。
|
static String |
bytesToHexString(byte[] bytes)
二进制转字符串。
|
static boolean |
equalsOne(String str,
String[] matchs)
如果str和matchs中任何一个匹配返回true,如果str=null或者matchs=null,返回false。
|
static String |
format(Object value,
String pattern)
把数据对象转换为字符串类型。
|
static <T> T |
get(Thing thing,
String attributeName,
ActionContext actionContext) |
static BigDecimal |
getBigDecimal(Object v,
BigDecimal defaultValue) |
static BigInteger |
getBigInteger(Object v,
BigInteger defaultValue) |
static boolean |
getBoolean(Object v,
boolean defaultValue) |
static byte |
getByte(Object v,
byte defaultValue) |
static byte[] |
getBytes(Object v,
byte[] defaultValue) |
static char |
getChar(Object v,
char defaultValue) |
static Object |
getData(String value,
ActionContext actionContext) |
static Object |
getData(Thing thing,
String attributeName,
ActionContext actionContext)
通过事物的属性获取数据。
|
static Date |
getDate(Object v,
Date defaultValue) |
static Date |
getDate(Object v,
Date defaultValue,
String pattern) |
static Date |
getDateDefault(String defaultValue) |
static double |
getDouble(Object v,
double defaultValue) |
static float |
getFloat(Object v,
float defaultValue) |
static int |
getInt(Object v,
int defaultValue) |
static long |
getLong(Object v,
long defaultValue) |
static Object |
getObject(Thing thing,
String attributeName,
ActionContext actionContext)
返回通过属性定义的对象,首先使用UtilData获取,如果没有从actionContext中获取。
|
static <T> T |
getObjectByType(Thing thing,
String attributeName,
Class<T> t,
ActionContext actionContext) |
static short |
getShort(Object v,
short defaultValue) |
static SimpleDateFormat |
getSimpleDateFormat(String dateStr) |
static String |
getSizeInfo(double size)
按照字节、千字节和兆返回大小的值。
|
static String |
getString(Object v,
String defaultValue) |
static String |
getString(Thing thing,
String attributeName,
ActionContext actionContext) |
static Thing |
getThing(Thing thing,
String attributeName,
ActionContext actionContext)
根据事物的属性返回指定的事物。
|
static Thing |
getThing(Thing thing,
String attributeName,
String childThingPath,
ActionContext actionContext)
先从事物指定的属性上获取事物,如果不存在从子节点的路径上获取。
|
static byte[] |
hexStringToByteArray(String hex)
将"00 01 02"形式的字符串转成byte[]
|
static boolean |
isTrue(Object condition) |
static boolean |
isTrue(Object condition,
boolean defaultValue)
判断condition是否为true, 当condition==null时返回传入的默认值。
|
static Object |
parse(String value,
String valueType,
String pattern) |
static void |
resetAttributeByType(Thing thing,
String name,
String type) |
static Object |
transfer(Object sourceValue,
String targetType,
String pattern,
String patternType,
String patternAction)
转换数据类型。
|
public static boolean equalsOne(String str, String[] matchs)
str - 字符串matchs - 匹配正则表达式public static String format(Object value, String pattern)
value - 值pattern - 格式public static Object parse(String value, String valueType, String pattern) throws ParseException
ParseExceptionpublic static List<Thing> addToSource(List<Thing> source, List<Thing> forAdd, boolean strict)
source - 源事物列表forAdd - 要添加的事物列表strict - 是否严格判断,如果是严格判断那么校验两个事物必须相等,否则校验事物的描述者和名public static List<Thing> addToSource(List<Thing> source, Thing forAdd, boolean strict)
source - 源事物列表forAdd - 需要添加的事物strict - 是否严格判断,如果是严格判断那么校验两个事物必须相等,否则校验事物的描述者和名public static BigDecimal getBigDecimal(Object v, BigDecimal defaultValue)
public static BigInteger getBigInteger(Object v, BigInteger defaultValue)
public static byte getByte(Object v, byte defaultValue)
public static byte[] getBytes(Object v, byte[] defaultValue)
public static char getChar(Object v, char defaultValue)
public static SimpleDateFormat getSimpleDateFormat(String dateStr)
public static double getDouble(Object v, double defaultValue)
public static float getFloat(Object v, float defaultValue)
public static long getLong(Object v, long defaultValue)
public static int getInt(Object v, int defaultValue)
public static short getShort(Object v, short defaultValue)
public static boolean getBoolean(Object v, boolean defaultValue)
public static String getSizeInfo(double size)
size - 大小public static byte[] hexStringToByteArray(String hex)
hex - 16进制字符串public static String bytesToHexString(byte[] bytes)
bytes - 字节数组public static Object transfer(Object sourceValue, String targetType, String pattern, String patternType, String patternAction) throws ParseException
sourceValue - 原值targetType - 目标值pattern - 格式patternType - 格式类型patternAction - 动作ParseException - 异常public static Object getObject(Thing thing, String attributeName, ActionContext actionContext)
thing - 事物attributeName - 属性名actionContext - 变量上下文public static <T> T get(Thing thing, String attributeName, ActionContext actionContext)
public static <T> T getObjectByType(Thing thing, String attributeName, Class<T> t, ActionContext actionContext)
public static Thing getThing(Thing thing, String attributeName, ActionContext actionContext)
thing - 事物attributeName - 属性名actionContext - 变量上下文public static Thing getThing(Thing thing, String attributeName, String childThingPath, ActionContext actionContext)
thing - 事物attributeName - 属性名childThingPath - 子事物节点actionContext - 变量上下文public static Object getData(Thing thing, String attributeName, ActionContext actionContext)
thing - 事物attributeName - 属性名actionContext - 变量上下文public static Object getData(String value, ActionContext actionContext)
public static boolean isTrue(Object condition)
public static boolean isTrue(Object condition, boolean defaultValue)
condition - defaultValue - public static String getString(Thing thing, String attributeName, ActionContext actionContext)
Copyright © 2022 xworker.org. All rights reserved.