public Object convertFromString()

in type-conversion/src/main/java/org/apache/struts/example/ThemeDescriptorConverter.java [18:30]


    public Object convertFromString(final Map context, final String[] values, final Class toClass) {
        if ((values != null) && (values.length > 0)) {
            try {
                if (Themes.contains(values[0])) {
                    return Themes.get(values[0]);
                }
                throw new RuntimeException("No theme with id: " + values[0]);
            } catch (Exception e) {
                throw new TypeConversionException("Unable to convert into a ThemeDescriptor: " + values[0], e);
            }
        }
        return null;
    }