Package com.alibaba.antx.config.descriptor

Examples of com.alibaba.antx.config.descriptor.ConfigValidatorException


    }

    @Override
    public boolean validate(String value) {
        if (StringUtil.isEmpty(getRegexp())) {
            throw new ConfigValidatorException("You must define an attribute called 'regexp' for regexp validator");
        }

        if (StringUtil.isEmpty(getMode())) {
            setMode("contain");
        }

        if (value == null) {
            return true;
        }

        value = value.trim();

        if (StringUtil.isEmpty(value)) {
            return true;
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Validating value with regexp[" + getRegexp() + "]: " + value);
        }

        Pattern pattern = null;

        try {
            pattern = new Perl5Compiler().compile(getRegexp(), Perl5Compiler.READ_ONLY_MASK
                    | Perl5Compiler.SINGLELINE_MASK);
        } catch (MalformedPatternException e) {
            throw new ConfigValidatorException(e);
        }

        if (!getMode().endsWith("contain") && !getMode().endsWith("exact") && !getMode().endsWith("prefix")) {
            throw new ConfigValidatorException("Invalid regexp mode: " + getMode()
                    + ", should be contain, exact or prefix.");
        }

        // ƥ��
        PatternMatcher matcher = new Perl5Matcher();
View Full Code Here


    @Override
    public boolean validate(String value) {
        String[] choices = getAllChoices();

        if (choices == null || choices.length == 0) {
            throw new ConfigValidatorException("You must define an attribute called 'choice' for choice validator");
        }

        if (value == null) {
            return true;
        }
View Full Code Here

    }

    @Override
    public boolean validate(String value) {
        if (StringUtil.isEmpty(getRegexp())) {
            throw new ConfigValidatorException("You must define an attribute called 'regexp' for regexp validator");
        }

        if (StringUtil.isEmpty(getMode())) {
            setMode("contain");
        }

        if (value == null) {
            return true;
        }

        value = value.trim();

        if (StringUtil.isEmpty(value)) {
            return true;
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Validating value with regexp[" + getRegexp() + "]: " + value);
        }

        Pattern pattern = null;

        try {
            pattern = new Perl5Compiler().compile(getRegexp(), Perl5Compiler.READ_ONLY_MASK
                    | Perl5Compiler.SINGLELINE_MASK);
        } catch (MalformedPatternException e) {
            throw new ConfigValidatorException(e);
        }

        if (!getMode().endsWith("contain") && !getMode().endsWith("exact") && !getMode().endsWith("prefix")) {
            throw new ConfigValidatorException("Invalid regexp mode: " + getMode()
                    + ", should be contain, exact or prefix.");
        }

        // ƥ��
        PatternMatcher matcher = new Perl5Matcher();
View Full Code Here

    @Override
    public boolean validate(String value) {
        String[] choices = getAllChoices();

        if (choices == null || choices.length == 0) {
            throw new ConfigValidatorException("You must define an attribute called 'choice' for choice validator");
        }

        if (value == null) {
            return true;
        }
View Full Code Here

    }

    @Override
    public boolean validate(String value) {
        if (StringUtil.isEmpty(getRegexp())) {
            throw new ConfigValidatorException("You must define an attribute called 'regexp' for regexp validator");
        }

        if (StringUtil.isEmpty(getMode())) {
            setMode("contain");
        }

        if (value == null) {
            return true;
        }

        value = value.trim();

        if (StringUtil.isEmpty(value)) {
            return true;
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Validating value with regexp[" + getRegexp() + "]: " + value);
        }

        Pattern pattern = null;

        try {
            pattern = new Perl5Compiler().compile(getRegexp(), Perl5Compiler.READ_ONLY_MASK
                                                               | Perl5Compiler.SINGLELINE_MASK);
        } catch (MalformedPatternException e) {
            throw new ConfigValidatorException(e);
        }

        if (!getMode().endsWith("contain") && !getMode().endsWith("exact") && !getMode().endsWith("prefix")) {
            throw new ConfigValidatorException("Invalid regexp mode: " + getMode()
                                               + ", should be contain, exact or prefix.");
        }

        // 匹配
        PatternMatcher matcher = new Perl5Matcher();
View Full Code Here

    @Override
    public boolean validate(String value) {
        String[] choices = getAllChoices();

        if (choices == null || choices.length == 0) {
            throw new ConfigValidatorException("You must define an attribute called 'choice' for choice validator");
        }

        if (value == null) {
            return true;
        }
View Full Code Here

TOP

Related Classes of com.alibaba.antx.config.descriptor.ConfigValidatorException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.