protected <QL> String getCypher(QL expression) {
if (expression instanceof String) {
return (String) expression;
} else if (expression instanceof AnnotatedElement) {
AnnotatedElement typeExpression = (AnnotatedElement) expression;
Cypher cypher = typeExpression.getAnnotation(Cypher.class);
if (cypher == null) {
throw new CdoException(typeExpression + " must be annotated with " + Cypher.class.getName());
}
return cypher.value();
}
throw new CdoException("Unsupported query expression " + expression);
}