本文整理汇总了Java中com.taobao.tddl.executor.utils.ExecUtils.isNull方法的典型用法代码示例。如果您正苦于以下问题:Java ExecUtils.isNull方法的具体用法?Java ExecUtils.isNull怎么用?Java ExecUtils.isNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.executor.utils.ExecUtils
的用法示例。
在下文中一共展示了ExecUtils.isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
Object arg = args[0];
if (ExecUtils.isNull(arg)) {
return null;
}
String str = DataType.StringType.convertFrom(arg);
if (TStringUtil.isEmpty(str)) {
return 0;
}
char leftMost = str.charAt(0);
DataType type = getReturnType();
return type.convertFrom(leftMost);
}
示例2: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
List<Character> chs = new ArrayList<Character>();
for (Object obj : args) {
if (!ExecUtils.isNull(obj)) {
Long data = DataType.LongType.convertFrom(obj);
chs.addAll(appendChars(data));
}
}
if (chs.size() == 0) {
return null;
}
StringBuilder builder = new StringBuilder();
for (Character ch : chs) {
builder.append(ch.charValue());
}
return builder.toString();
}
示例3: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
if (ExecUtils.isNull(args[0])) {
return null;
}
DataType type = DataTypeUtil.getTypeOfObject(args[0]);
if (type == DataType.StringType) {
String strVal = DataType.StringType.convertFrom(args[0]);
StringBuilder sb = new StringBuilder();
for (Byte b : strVal.getBytes()) {
sb.append(Integer.toHexString(b & 0xff));
}
return sb.toString();
} else {
BigInteger intVal = DataType.BigIntegerType.convertFrom(args[0]);
return intVal.toString(16).toUpperCase();
}
}
示例4: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
for (Object arg : args) {
if (ExecUtils.isNull(arg)) {
return null;
}
}
String value = DataType.StringType.convertFrom(args[0]);
Integer peroid = DataType.IntegerType.convertFrom(args[1]);
try {
java.util.Date date = OptimizerUtils.parseDate(value, DATE_FORMATS);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, peroid);
return cal.get(Calendar.YEAR) * 100 + cal.get(Calendar.MONTH) + 1;
} catch (ParseException e) {
throw new FunctionException(e);
}
}
示例5: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
Object arg = args[0];
if (ExecUtils.isNull(arg)) {
return null;
}
BigInteger longlong = DataType.BigIntegerType.convertFrom(arg);
if (longlong == null) {
return "0";
}
return longlong.toString(2);
}
示例6: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
Object arg = args[0];
if (ExecUtils.isNull(arg)) {
return null;
}
BigInteger longlong = DataType.BigIntegerType.convertFrom(arg);
if (longlong == null) {
return "0";
}
return longlong.toString(8);
}
示例7: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
for (Object arg : args) {
if (ExecUtils.isNull(arg)) {
return null;
}
}
java.sql.Timestamp timestamp = DataType.TimestampType.convertFrom(args[0]);
Calendar cal = Calendar.getInstance();
cal.setTime(timestamp);
Object day = args[1];
if (day instanceof IntervalType) {
((IntervalType) day).process(cal, 1);
} else {
cal.add(Calendar.DAY_OF_YEAR, DataType.IntegerType.convertFrom(day));
}
DataType type = getReturnType();
return type.convertFrom(cal);
}
示例8: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
for (Object arg : args) {
if (ExecUtils.isNull(arg)) {
return null;
}
}
String value = DataType.StringType.convertFrom(args[0]);
String format = DataType.StringType.convertFrom(args[1]);
SimpleDateFormat dateFormat = new SimpleDateFormat(DateFormat.convertToJavaDataFormat(format));
java.util.Date date = null;
try {
date = dateFormat.parse(value);
} catch (ParseException e) {
return null;
}
DataType type = getReturnType();
return type.convertFrom(date);
}
示例9: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
if (ExecUtils.isNull(args[0])) {
return null;
}
BigInteger bitsValue = DataType.BigIntegerType.convertFrom(args[0]);
String bitsStringReverse = TStringUtil.reverse(bitsValue.toString(2));
List<String> sets = new LinkedList();
for (int i = 1; i < args.length && i - 1 < bitsStringReverse.length(); i++) {
if (ExecUtils.isNull(args[i])) {
continue;
}
if (bitsStringReverse.charAt(i - 1) == '1') {
sets.add(DataType.StringType.convertFrom(args[i]));
}
}
return TStringUtil.join(sets, ",");
}
示例10: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
for (Object arg : args) {
if (ExecUtils.isNull(arg)) {
return null;
}
}
String substr = DataType.StringType.convertFrom(args[0]);
String str = DataType.StringType.convertFrom(args[1]);
Integer pos = null;
if (args.length == 3) {
pos = DataType.IntegerType.convertFrom(args[2]);
}
if (pos == null) {
return TStringUtil.indexOf(str, substr) + 1;
} else {
return TStringUtil.indexOf(str, substr, pos + 1) + 1;
}
}
示例11: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
DataType type = getReturnType();
if (ExecUtils.isNull(args[0])) {
return null;
}
BigDecimal d = DataType.BigDecimalType.convertFrom(args[0]);
int x = 0;
if (args.length >= 2 && !ExecUtils.isNull(args[1])) {
x = DataType.IntegerType.convertFrom(args[1]);
}
if (x >= 0) {
int precision = d.precision() - d.scale() + x;
if (precision < 0) {
d = BigDecimal.ZERO;
} else {
d = d.round(new MathContext(precision, RoundingMode.DOWN));
}
} else {
x = Math.abs(x);
d = d.movePointLeft(x).setScale(0, RoundingMode.DOWN).multiply(new BigDecimal(10).pow(x));
}
return type.convertFrom(d);
}
示例12: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
DataType type = getReturnType();
if (ExecUtils.isNull(args[0])) {
return null;
}
Double d = (Double) type.convertFrom(args[0]);
if (args.length >= 2) {
if (ExecUtils.isNull(args[1])) {
return null;
}
Double y = (Double) type.convertFrom(args[1]);
return Math.atan2(d, y);
} else {
return Math.atan(d);
}
}
示例13: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
for (Object arg : args) {
if (ExecUtils.isNull(arg)) {
return null;
}
}
return paseIntervalDate(args[0], args[1]);
}
示例14: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
DataType type = getReturnType();
if (ExecUtils.isNull(args[0])) {
return null;
}
Double d = (Double) type.convertFrom(args[0]);
return Math.toRadians(d);
}
示例15: compute
import com.taobao.tddl.executor.utils.ExecUtils; //导入方法依赖的package包/类
@Override
public Object compute(Object[] args, ExecutionContext ec) {
if (ExecUtils.isNull(args[0])) {
return "NULL";
}
String str = DataType.StringType.convertFrom(args[0]);
StringBuilder sb = new StringBuilder();
sb.append("'").append(TStringUtil.replace(str, "'", "\\'")).append("'");
return sb.toString();
}