PrintModelFiledClassFunction.java 901 B

1234567891011121314151617181920212223242526272829303132333435
  1. package com.sooka.component.beetl.fun;
  2. import com.sooka.common.db.kit.DbTableKit;
  3. import org.beetl.core.Context;
  4. import org.beetl.core.Function;
  5. /**
  6. * Description:输出字段类型名称
  7. *
  8. *
  9. * @create 2017-05-12
  10. **/
  11. public class PrintModelFiledClassFunction implements Function {
  12. @Override
  13. public Object call(Object[] objects, Context context) {
  14. if (objects.length != 1){
  15. throw new RuntimeException("length of params must be 1 !");
  16. }
  17. if (objects[0].toString().length()!=0) {
  18. String var = (String) objects[0];
  19. for (String val : DbTableKit.MODEL_FILED_CLASS) {
  20. String[] tmp = val.split("#");
  21. System.out.println(tmp);
  22. if (tmp[0].equals(var)) {
  23. return tmp[1];
  24. }
  25. continue;
  26. }
  27. }
  28. return null;
  29. }
  30. }