Package ptolemy.actor.gt

Examples of ptolemy.actor.gt.ValidationException


    }

    public void validate() throws ValidationException {
        if (isAttributeNameEnabled()) {
            if (_attributeName.get().equals("")) {
                throw new ValidationException(
                        "Attribute name must not be empty.");
            }

            try {
                _attributeName.getPattern();
            } catch (PatternSyntaxException e) {
                throw new ValidationException("Regular expression \""
                        + _attributeName + "\" cannot be compiled.", e);
            }
        }

        if (isAttributeTypeEnabled()) {
            if (_attributeType.get().equals("")) {
                throw new ValidationException("Port type must not be empty.");
            }

            try {
                _attributeType.getToken().getType();
            } catch (IllegalActionException e) {
                throw new ValidationException("Type expression \""
                        + _attributeType + "\" cannot be parsed.", e);
            }
        }

        if (isAttributeValueEnabled()) {
            try {
                _attributeValue.getToken();
            } catch (IllegalActionException e) {
                throw new ValidationException("Value expression \""
                        + _attributeValue + "\" cannot be parsed.", e);
            }
        }
    }
View Full Code Here


        _superclass = _decodeStringField(0, fieldIterator);
    }

    public void validate() throws ValidationException {
        if (_superclass.equals("")) {
            throw new ValidationException("Superclass name must not be "
                    + "empty.");
        }
        Class<?> superclass;
        try {
            superclass = Class.forName(_superclass);
        } catch (Throwable t) {
            throw new ValidationException("Cannot load class \"" + _superclass
                    + "\".", t);
        }

        try {
            superclass.asSubclass(Actor.class);
        } catch (Throwable t) {
            throw new ValidationException("Superclass must be a subclass "
                    + "of \"" + Actor.class.getName() + "\".", t);
        }
    }
View Full Code Here

        _name = _decodeStringField(0, fieldIterator);
    }

    public void validate() throws ValidationException {
        if (_name.equals("")) {
            throw new ValidationException("Name must not be empty.");
        }
        if (_name.contains(".")) {
            throw new ValidationException("Name must not have period (\".\") "
                    + "in it.");
        }
    }
View Full Code Here

    }

    public void validate() throws ValidationException {
        if (isPortNameEnabled()) {
            if (_portName.get().equals("")) {
                throw new ValidationException("Port name must not be empty.");
            }

            try {
                _portName.getPattern();
            } catch (PatternSyntaxException e) {
                throw new ValidationException("Regular expression \""
                        + _portName + "\" cannot be compiled.", e);
            }
        }

        if (isPortTypeEnabled()) {
            if (_portType.get().equals("")) {
                throw new ValidationException("Port type must not be empty.");
            }

            try {
                _portType.getToken().getType();
            } catch (IllegalActionException e) {
                throw new ValidationException("Type expression \"" + _portType
                        + "\" cannot be parsed.", e);
            }
        }
    }
View Full Code Here

        setAttributeValue(_decodeStringField(2, fieldIterator));
    }

    public void validate() throws ValidationException {
        if (_attributeName.equals("")) {
            throw new ValidationException("Name must not be empty.");
        }
        if (_attributeName.contains(".")) {
            throw new ValidationException("Name must not have period (\".\") "
                    + "in it.");
        }

        if (isAttributeClassEnabled()) {
            if (_attributeClass.equals("")) {
                throw new ValidationException("Class must not be empty.");
            }

            try {
                Class.forName(_attributeClass);
            } catch (Throwable t) {
                throw new ValidationException("Cannot load class \""
                        + _attributeClass + "\".", t);
            }
        }

        if (_valueParseTree == null) {
            try {
                _reparse();
            } catch (IllegalActionException e) {
                throw new ValidationException(
                        "Unable to parse attribute value.");
            }
        }
    }
View Full Code Here

TOP

Related Classes of ptolemy.actor.gt.ValidationException

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.