}
if (literalValue instanceof Collection || literalValue instanceof Object[]) return literalValue;
return type.create(literalValue); // without converting!
}
if (staticOperand instanceof LiteralValue) {
LiteralValue literal = (LiteralValue)staticOperand;
Value value = literal.getLiteralValue();
if (value != null) {
// Use the proper type factory to ensure the value is the correct type ...
PropertyType propType = PropertyTypeUtil.modePropertyTypeFor(value.getType());
try {
literalValue = context.getExecutionContext().getValueFactories().getValueFactory(propType)
.create(value.getString());
} catch (RepositoryException e) {
// Really shouldn't happen, but just in case ...
throw new SystemFailureException(e);
}
}
} else if (staticOperand instanceof Literal) {
Literal literal = (Literal)staticOperand;
literalValue = literal.value();
}
return type != null ? type.create(literalValue) : null;
}