public String getExpressionValue(Expression expression, Feature feature) {
if ((expression == null) || (feature == null)) {
return null;
}
if (expression.getClass().isAssignableFrom(LiteralExpressionImpl.class)) {
LiteralExpressionImpl v = (LiteralExpressionImpl) expression;
byte[] utf8Bytes = null;
String result = "";
try {
utf8Bytes = v.toString().getBytes("UTF8");
result = new String(utf8Bytes, "UTF8");
} catch (UnsupportedEncodingException e) {
return "";
}
return result;
}
if (expression.getClass().isAssignableFrom(
AttributeExpressionImpl.class)) {
AttributeExpressionImpl v = (AttributeExpressionImpl) expression;
String property = v.getPropertyName();
Object o = feature.getProperty(property).getValue();
if (o != null) {
return o.toString();
}
}