public FileDownloadPath apply(String pathStr) {
return AutoBeanUtil.decode(FileDownloadPath.class, pathStr);
}
});
EvaluationResult r = e.evaluate(new ProcessDataRecord() {
@Override
public FileDownloadPath lookupFileReference(Integer index) {
return files.get(index);
}
@Override
public EvaluationResult lookup(String name) {
if (isNullOrEmpty(name)) {
return null;
} else { // normal case, include key selection and property selection
Object payload = Datastore.KEY_RESERVED_NAME.equals(name) ? entity.getKey() : entity.getProperty(name);
return new EvaluationResult(entity.getKey(), name, null, payload);
}
}
@Override
public Iterable<EvaluationResult> asIterable() {
// should not be called
throw new IllegalArgumentException();
}
});
PropertyInfo info = DatastoreUtil.convert(keyString, null, null, r.getPayload(), r.getWarnings());
return info;
} catch (RecognitionException e) {
// can't parse input
logger.log(Level.SEVERE, e.getMessage(), e);
throw new YaacException(null, e.getMessage());