diff options
author | James Moger <james.moger@gitblit.com> | 2017-01-31 08:13:38 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2017-01-31 08:13:38 -0500 |
commit | 2a1c37906f20fcd1e777e28528915b726fd5bfe7 (patch) | |
tree | 629b52bb2fc11eabaf5d6af84955e10067b8e8a2 /src/main/java/com/iciql/ModelUtils.java | |
parent | 629ff966b7626dcfbfa22b69518dabf435264760 (diff) | |
download | iciql-2a1c37906f20fcd1e777e28528915b726fd5bfe7.tar.gz iciql-2a1c37906f20fcd1e777e28528915b726fd5bfe7.zip |
Allow definition of numeric default values by string
Diffstat (limited to 'src/main/java/com/iciql/ModelUtils.java')
-rw-r--r-- | src/main/java/com/iciql/ModelUtils.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/com/iciql/ModelUtils.java b/src/main/java/com/iciql/ModelUtils.java index 14dc615..eb48faf 100644 --- a/src/main/java/com/iciql/ModelUtils.java +++ b/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()) { |