public <T> T construct(Class<T> componentType, String componentName) {
Object comp;
if (componentName.equals(GLOBAL_MARSHALLER))
comp = new GlobalMarshaller(createMarshaller());
else if (componentName.equals(CACHE_MARSHALLER))
comp = new CacheMarshaller(createMarshaller());
else
throw new CacheException("Don't know how to handle type " + componentType);
try {
return componentType.cast(comp);