程序包 org.xmeta.util
类 UtilData
java.lang.Object
org.xmeta.util.UtilData
数据工具类。
- 作者:
- zyx
-
字段概要
字段修饰符和类型字段说明static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明addToSource(List<Thing> source, List<Thing> forAdd, boolean strict) 添加指定的模型列表到已有的模型列表中,添加时如果存在第一个的描述者相同且名字相同的则不添加。addToSource(List<Thing> source, Thing forAdd, boolean strict) 添加指定的模型到源模型列表中。static StringbytesToHexString(byte[] bytes) 二进制转字符串。static boolean如果str和matchs中任何一个匹配返回true,如果str=null或者matchs=null,返回false。static String把数据对象转换为字符串类型。static <T> Tget(Thing thing, String attributeName, ActionContext actionContext) static BigDecimalgetBigDecimal(Object v, BigDecimal defaultValue) static BigIntegergetBigInteger(Object v, BigInteger defaultValue) static booleangetBoolean(Object v, boolean defaultValue) static bytestatic byte[]static charstatic ObjectgetData(String value, ActionContext actionContext) static ObjectgetData(Thing thing, String attributeName, ActionContext actionContext) 通过模型的属性获取数据。static Datestatic Datestatic DategetDateDefault(String defaultValue) static doublestatic floatstatic intstatic longstatic ObjectgetObject(Thing thing, String attributeName, ActionContext actionContext) 返回通过属性定义的对象,首先使用UtilData获取,如果没有从actionContext中获取。static <T> TgetObjectByType(Thing thing, String attributeName, Class<T> t, ActionContext actionContext) static shortstatic SimpleDateFormatgetSimpleDateFormat(String dateStr) static StringgetSizeInfo(double size) 按照字节、千字节和兆返回大小的值。static Stringstatic StringgetString(Thing thing, String attributeName, ActionContext actionContext) static ThinggetThing(Thing thing, String attributeName, String childThingPath, ActionContext actionContext) 先从模型指定的属性上获取模型,如果不存在从子节点的路径上获取。static ThinggetThing(Thing thing, String attributeName, ActionContext actionContext) 根据模型的属性返回指定的模型。static byte[]将"00 01 02"形式的字符串转成byte[]static booleanstatic boolean判断condition是否为true, 当condition==null时返回传入的默认值。static Objectstatic voidresetAttributeByType(Thing thing, String name, String type) static Objecttransfer(Object sourceValue, String targetType, String pattern, String patternType, String patternAction) 转换数据类型。
-
字段详细资料
-
VALUE_BLANK
- 另请参阅:
-
VALUE_ONE
- 另请参阅:
-
VALUE_ZERO
- 另请参阅:
-
VALUE_FALSE
- 另请参阅:
-
VALUE_TRUE
- 另请参阅:
-
VALUE_CURRENT_DATE
- 另请参阅:
-
VALUE_NOW
- 另请参阅:
-
TYPE_STRING
- 另请参阅:
-
TYPE_INT
- 另请参阅:
-
TYPE_INTEGER
- 另请参阅:
-
TYPE_LONG
- 另请参阅:
-
TYPE_FLOAT
- 另请参阅:
-
TYPE_DOUBLE
- 另请参阅:
-
TYPE_SHORT
- 另请参阅:
-
TYPE_BYTE
- 另请参阅:
-
TYPE_BIGDECIMAL
- 另请参阅:
-
TYPE_BIGINTEGER
- 另请参阅:
-
TYPE_BOOLEAN
- 另请参阅:
-
TYPE_DATE
- 另请参阅:
-
TYPE_TIME
- 另请参阅:
-
TYPE_DATETIME
- 另请参阅:
-
TYPE_BYTES
- 另请参阅:
-
TYPE_OBJECT
- 另请参阅:
-
-
构造器详细资料
-
UtilData
public UtilData()
-
-
方法详细资料
-
equalsOne
如果str和matchs中任何一个匹配返回true,如果str=null或者matchs=null,返回false。- 参数:
str- 字符串matchs- 匹配正则表达式- 返回:
- 是否匹配
-
format
把数据对象转换为字符串类型。- 参数:
value- 值pattern- 格式- 返回:
- 结果
-
parse
- 抛出:
ParseException
-
addToSource
添加指定的模型列表到已有的模型列表中,添加时如果存在第一个的描述者相同且名字相同的则不添加。- 参数:
source- 源模型列表forAdd- 要添加的模型列表strict- 是否严格判断,如果是严格判断那么校验两个模型必须相等,否则校验模型的描述者和名- 返回:
- 结果
-
addToSource
添加指定的模型到源模型列表中。- 参数:
source- 源模型列表forAdd- 需要添加的模型strict- 是否严格判断,如果是严格判断那么校验两个模型必须相等,否则校验模型的描述者和名- 返回:
- 模型列表
-
getBigDecimal
-
getBigInteger
-
getByte
-
getBytes
-
getChar
-
getDate
-
getDateDefault
-
getDate
-
getSimpleDateFormat
-
getDouble
-
getFloat
-
getLong
-
getInt
-
getShort
-
getBoolean
-
getString
-
getSizeInfo
按照字节、千字节和兆返回大小的值。- 参数:
size- 大小- 返回:
- 字符串
-
hexStringToByteArray
将"00 01 02"形式的字符串转成byte[]- 参数:
hex- 16进制字符串- 返回:
- 字节数组
-
bytesToHexString
二进制转字符串。- 参数:
bytes- 字节数组- 返回:
- 16进制字符串
-
transfer
public static Object transfer(Object sourceValue, String targetType, String pattern, String patternType, String patternAction) throws ParseException 转换数据类型。- 参数:
sourceValue- 原值targetType- 目标值pattern- 格式patternType- 格式类型patternAction- 动作- 返回:
- 转换后的结果
- 抛出:
ParseException- 异常
-
getObject
返回通过属性定义的对象,首先使用UtilData获取,如果没有从actionContext中获取。- 参数:
thing- 模型attributeName- 属性名actionContext- 变量上下文- 返回:
- 对象
-
get
-
getObjectByType
public static <T> T getObjectByType(Thing thing, String attributeName, Class<T> t, ActionContext actionContext) -
getThing
根据模型的属性返回指定的模型。- 参数:
thing- 模型attributeName- 属性名actionContext- 变量上下文- 返回:
- 模型,如果不存在返回null
-
getThing
public static Thing getThing(Thing thing, String attributeName, String childThingPath, ActionContext actionContext) 先从模型指定的属性上获取模型,如果不存在从子节点的路径上获取。- 参数:
thing- 模型attributeName- 属性名childThingPath- 子模型节点actionContext- 变量上下文- 返回:
- 要返回的额模型,如果不存在返回null
-
getData
通过模型的属性获取数据。- 参数:
thing- 模型attributeName- 属性名actionContext- 变量上下文- 返回:
- 结果
-
getData
-
isTrue
-
isTrue
判断condition是否为true, 当condition==null时返回传入的默认值。- 参数:
condition- 条件defaultValue- 默认值- 返回:
- 是否为真
-
getString
-
resetAttributeByType
-