浏览代码

Allow definition of numeric default values by string

tags/release-2.2.0
James Moger 7 年前
父节点
当前提交
2a1c37906f
共有 1 个文件被更改,包括 11 次插入1 次删除
  1. 11
    1
      src/main/java/com/iciql/ModelUtils.java

+ 11
- 1
src/main/java/com/iciql/ModelUtils.java 查看文件

@@ -407,9 +407,11 @@ class ModelUtils {
if (isNullOrEmpty(defaultValue)) {
return true;
}
Pattern numericDefault = Pattern.compile("\\d+");
Pattern literalDefault = Pattern.compile("'.*'");
Pattern functionDefault = Pattern.compile("[^'].*[^']");
return literalDefault.matcher(defaultValue).matches()
return numericDefault.matcher(defaultValue).matches()
|| literalDefault.matcher(defaultValue).matches()
|| functionDefault.matcher(defaultValue).matches();
}

@@ -431,6 +433,14 @@ class ModelUtils {
return true;
}

// numeric value
Pattern numericDefault = Pattern.compile("\\d+");
if (numericDefault.matcher(defaultValue).matches()) {
// assume numeric values are legal
return true;
}


// function / variable
Pattern functionDefault = Pattern.compile("[^'].*[^']");
if (functionDefault.matcher(defaultValue).matches()) {

正在加载...
取消
保存