コード例 #1
0
ファイル: SimpleConfig.java プロジェクト: ksaka9821/config
 @Override
 public boolean hasPath(String pathExpression) {
   Path path = Path.newPath(pathExpression);
   ConfigValue peeked;
   try {
     peeked = object.peekPath(path);
   } catch (ConfigException.NotResolved e) {
     throw ConfigImpl.improveNotResolved(path, e);
   }
   return peeked != null && peeked.valueType() != ConfigValueType.NULL;
 }
コード例 #2
0
ファイル: SimpleConfig.java プロジェクト: ksaka9821/config
 private static AbstractConfigValue find(
     AbstractConfigObject self, Path path, ConfigValueType expected, Path originalPath) {
   try {
     String key = path.first();
     Path next = path.remainder();
     if (next == null) {
       return findKey(self, key, expected, originalPath);
     } else {
       AbstractConfigObject o =
           (AbstractConfigObject)
               findKey(
                   self,
                   key,
                   ConfigValueType.OBJECT,
                   originalPath.subPath(0, originalPath.length() - next.length()));
       assert (o != null); // missing was supposed to throw
       return find(o, next, expected, originalPath);
     }
   } catch (ConfigException.NotResolved e) {
     throw ConfigImpl.improveNotResolved(path, e);
   }
 }