原
PropertyExpr parsePropertyExpr(String key) { if (key.startsWith("${") && key.endsWith("}")) { // 是否存在defaultValue? int n = key.indexOf(':'); if (n == (-1)) { // 没有defaultValue: ${key} String k = key.substring(2, key.length() - 1); return new PropertyExpr(k, null); } else { // 有defaultValue: ${key:default} String k = key.substring(2, n); return new PropertyExpr(k, key.substring(n + 1, key.length() - 1)); } return null; } }
应
PropertyExpr parsePropertyExpr(String key) { if (key.startsWith("${") && key.endsWith("}")) { // 是否存在defaultValue? int n = key.indexOf(':'); if (n == (-1)) { // 没有defaultValue: ${key} String k = key.substring(2, key.length() - 1); return new PropertyExpr(k, null); } else { // 有defaultValue: ${key:default} String k = key.substring(2, n); return new PropertyExpr(k, key.substring(n + 1, key.length() - 1)); } } return null; }
👍
Sign in to make a reply
R8HLR6CC
原
应