{
decorator = ReflectHelper.classForName(decoratorName).newInstance();
}
catch (ClassNotFoundException e)
{
throw new DecoratorInstantiationException(DefaultDecoratorFactory.class, decoratorName, e);
}
catch (InstantiationException e)
{
throw new DecoratorInstantiationException(DefaultDecoratorFactory.class, decoratorName, e);
}
catch (IllegalAccessException e)
{
throw new DecoratorInstantiationException(DefaultDecoratorFactory.class, decoratorName, e);
}
}
if (decorator instanceof DisplaytagColumnDecorator)
{
return (DisplaytagColumnDecorator) decorator;
}
else if (decorator instanceof ColumnDecorator)
{
return new DeprecatedDecoratorWrapper((ColumnDecorator) decorator);
}
else
{
throw new DecoratorInstantiationException(
DefaultDecoratorFactory.class,
decoratorName,
new ClassCastException(decorator.getClass().getName()));
}
}