Examples of ChoiceValue


Examples of com.volantis.shared.metadata.value.ChoiceValue

            //   definitions is empty.
            // * Choice name must be equal to the name of one of the choice
            //   definitions.
            // * Choice value must pass verification of its choice definition
            //   type.
            final ChoiceValue choiceValue = (ChoiceValue) value;
           
            final String choiceName = choiceValue.getChoiceName();
           
            if (choiceName == null) {
                if (!choiceDefinitions.isEmpty()) {
                    errors.add(new VerificationError(
                            VerificationError.CHOICE_NAME_NULL,
                            path,
                            value,
                            null,
                            "Null choice name."));
                }
            } else {
                final ChoiceDefinition choiceDefinition =
                    getChoiceDefinition(choiceName);
               
                if (choiceDefinition == null) {
                    // No choice definition for selected choice name is an error.
                    errors.add(new VerificationError(
                            VerificationError.TYPE_UNEXPECTED_VALUE,
                            path,
                            value,
                            null,
                            "Choice '" + choiceName + "' is not expected here."));
                } else {
                    // Verify choice value against its type.
                    Collection valueErrors =
                        choiceDefinition.getType().verify(choiceValue.getValue());
                   
                    errors.addAll(valueErrors);
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.