| | |
| | | |
| | | try { |
| | | validateValue(value, options); |
| | | } catch (IllegalPropertyValueException e) { |
| | | throw new IllegalPropertyValueStringException(this, value, e.getCause()); |
| | | } catch (PropertyException e) { |
| | | throw PropertyException.illegalPropertyValueException(this, value, e.getCause()); |
| | | } |
| | | |
| | | return value; |
| | |
| | | * The class representing the requested type. |
| | | * @return Returns the named class cast to a subclass of the specified |
| | | * class. |
| | | * @throws IllegalPropertyValueException |
| | | * @throws PropertyException |
| | | * If the named class was invalid, could not be loaded, or did |
| | | * not implement the required interfaces. |
| | | * @throws ClassCastException |
| | |
| | | private void validateClassName(String className) { |
| | | String nvalue = className.trim(); |
| | | if (!nvalue.matches(CLASS_RE)) { |
| | | throw new IllegalPropertyValueException(this, className); |
| | | throw PropertyException.illegalPropertyValueException(this, className); |
| | | } |
| | | } |
| | | |
| | |
| | | for (String i : instanceOfInterfaces) { |
| | | Class<?> instanceOfClass = loadClassForValidation(className, i, initialize); |
| | | if (!instanceOfClass.isAssignableFrom(theClass)) { |
| | | throw new IllegalPropertyValueException(this, className); |
| | | throw PropertyException.illegalPropertyValueException(this, className); |
| | | } |
| | | } |
| | | return theClass; |
| | |
| | | return loadClass(classToBeLoaded.trim(), initialize); |
| | | } catch (ClassNotFoundException e) { |
| | | // If the class cannot be loaded then it is an invalid value. |
| | | throw new IllegalPropertyValueException(this, componentClassName, e); |
| | | throw PropertyException.illegalPropertyValueException(this, componentClassName, e); |
| | | } catch (LinkageError e) { |
| | | // If the class cannot be initialized then it is an invalid value. |
| | | throw new IllegalPropertyValueException(this, componentClassName, e); |
| | | throw PropertyException.illegalPropertyValueException(this, componentClassName, e); |
| | | } |
| | | } |
| | | } |