final Object value,
final Class[] type)
throws FunctionEvaluationException
{
// ok, this is going to be expensive. Kids, you dont wanna try this at home ...
final ResourceManager manager = process.getResourceManager();
final ResourceKey baseKey = DocumentContextUtility.getBaseResource
(process.getDocumentContext());
try
{
final ResourceKey key;
if (value instanceof ResourceKey)
{
key = (ResourceKey) value;
}
else if (baseKey == null)
{
key = manager.createKey(value);
}
else if (value instanceof String)
{
key = manager.deriveKey(baseKey, (String) value);
}
else
{
throw new FunctionEvaluationException
("Failed to create URI: Resource loading failed: Key not derivable");
}
final Resource res = manager.create(key, baseKey, type);
return new CSSResourceValue(res);
}
catch (Exception e)
{
throw new FunctionEvaluationException