private Validator createValidator()

in src/java/org/apache/fulcrum/intake/model/Field.java [1100:1148]


    private Validator<T> createValidator(String validatorClassName)
            throws IntakeException
    {
        Validator<T> v;

        try
        {
            v = (Validator<T>)
                    Class.forName(validatorClassName).newInstance();
        }
        catch (InstantiationException e)
        {
            throw new IntakeException(
                    "Could not create new instance of Validator("
                    + validatorClassName + ")", e);
        }
        catch (IllegalAccessException e)
        {
            throw new IntakeException(
                    "Could not create new instance of Validator("
                    + validatorClassName + ")", e);
        }
        catch (ClassNotFoundException e)
        {
            throw new IntakeException(
                    "Could not load Validator class("
                    + validatorClassName + ")", e);
        }

        if (v instanceof LogEnabled)
        {
        	((LogEnabled)v).enableLogging(log);
        }

        // this should always be true for now
        // (until bean property initialization is implemented)
        if (v instanceof InitableByConstraintMap)
        {
            ((InitableByConstraintMap) v).init(this.ruleMap);
        }
        else
        {
            throw new IntakeError(
                    "All Validation objects must be subclasses of "
                    + "InitableByConstraintMap");
        }

        return v;
    }