Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  //
  // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.6-01/24/2006 06:15 PM(kohsuke)-fcs 
  // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
  // Any modifications to this file will be lost upon recompilation of the source schema. 
  // Generated on: 2007.03.26 at 04:39:11 PM CEST 
  //
  
  
  package org.jvnet.jaxbvalidation.tests.one.validation;
 
 {
 
 
     public void check(org.jvnet.jaxbcommons.locator.ObjectLocator locatorjavax.xml.bind.ValidationEventHandler handlerjava.lang.Object draftValue) {
         if (draftValue!= null) {
             final org.jvnet.jaxbvalidation.tests.one.AircraftType value = ((org.jvnet.jaxbvalidation.tests.one.AircraftTypedraftValue);
             {
                 final org.jvnet.jaxbcommons.locator.FieldObjectLocator fieldLocator = new org.jvnet.jaxbcommons.locator.DefaultFieldObjectLocator(locatorvalue"Name");
                 if (!value.isSetName()) {
                     // Report missing object
                     handler.handleEvent(new org.jvnet.jaxbvalidation.event.ObjectValidationEvent(fieldLocatornew org.jvnet.jaxbvalidation.problem.structure.EmptyFieldProblem()));
                 } else {
                     // Check value
                     fieldValidator.check(fieldLocatorhandlervalue.getName());
                 }
             }
             {
                 final org.jvnet.jaxbcommons.locator.FieldObjectLocator fieldLocator = new org.jvnet.jaxbcommons.locator.DefaultFieldObjectLocator(locatorvalue"Wtc");
                 if (!value.isSetWtc()) {
                     // Report missing object
                     handler.handleEvent(new org.jvnet.jaxbvalidation.event.ObjectValidationEvent(fieldLocatornew org.jvnet.jaxbvalidation.problem.structure.EmptyFieldProblem()));
                 } else {
                     // Check value
                     fieldValidator.check(fieldLocatorhandlervalue.getWtc());
                 }
             }
         }
     }
 
     {
 
 
         public void check(org.jvnet.jaxbcommons.locator.ObjectLocator locatorjavax.xml.bind.ValidationEventHandler handlerjava.lang.Object value) {
             checkValue(locatorhandlervalue);
         }
 
         public void checkValue(org.jvnet.jaxbcommons.locator.ObjectLocator locatorjavax.xml.bind.ValidationEventHandler handlerjava.lang.Object draftValue) {
             final java.lang.String value = ((java.lang.StringdraftValue);
             if (value instanceof java.lang.String) {
                 java.lang.String realValue = ((java.lang.Stringvalue);
                 // Check primitive value
                 {
                     // Perform the check
                     // Checking class com.sun.msv.datatype.xsd.PatternFacet datatype
                     org.jvnet.jaxbvalidation.problem.datatype.ValueProblem problem = null;
                     if (((null == realValue)? 0 :realValue.length())>= 2) {
                         // Value length is correct
                     } else {
                         problem = new org.jvnet.jaxbvalidation.problem.datatype.TooShortProblem(realValue, ((null == realValue)? 0 :realValue.length()), 2);
                     }
                     if (((null == realValue)? 0 :realValue.length())<= 4) {
                         // Value length is correct
                     } else {
                         problem = new org.jvnet.jaxbvalidation.problem.datatype.TooLongProblem(realValue, ((null == realValue)? 0 :realValue.length()), 4);
                     }
                     if (!new com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression("[A-Za-z][A-Za-z][A-Za-z]?[A-Za-z]?""X").matches(realValue.toString())) {
                         problem = new org.jvnet.jaxbvalidation.problem.datatype.RegularExpressionProblem(realValue"[A-Za-z][A-Za-z][A-Za-z]?[A-Za-z]?");
                     }
                     if (null!= problem) {
                         // Handle event
                         handler.handleEvent(new org.jvnet.jaxbvalidation.event.ObjectValidationEvent(locatorproblem));
                     }
                 }
             } else {
                 if (null == value) {
                     // todo: report null
                 } else {
                     // Report wrong class
                     handler.handleEvent(new org.jvnet.jaxbvalidation.event.ObjectValidationEvent(locatornew org.jvnet.jaxbvalidation.problem.structure.NonExpectedClassProblem(value.getClass())));
                 }
             }
         }
 
     }
 
     {
 
         protected java.lang.Object[] values = new java.lang.Object[] {"M""N""L"};
         protected java.util.Set valueSet = java.util.Collections.unmodifiableSet(new java.util.HashSet(java.util.Arrays.asList()));
 
         public void check(org.jvnet.jaxbcommons.locator.ObjectLocator locatorjavax.xml.bind.ValidationEventHandler handlerjava.lang.Object value) {
            checkValue(locatorhandlervalue);
        }
        public void checkValue(org.jvnet.jaxbcommons.locator.ObjectLocator locatorjavax.xml.bind.ValidationEventHandler handlerjava.lang.Object draftValue) {
            final java.lang.String value = ((java.lang.StringdraftValue);
            if (value instanceof java.lang.String) {
                java.lang.String realValue = ((java.lang.Stringvalue);
                // Check primitive value
                {
                    // Perform the check
                    // Checking class com.sun.msv.datatype.xsd.EnumerationFacet datatype
                    org.jvnet.jaxbvalidation.problem.datatype.ValueProblem problem = null;
                    if (.contains(realValue)) {
                        // Value is found in the enumeration, it is valid
                    } else {
                        problem = new org.jvnet.jaxbvalidation.problem.datatype.EnumerationProblem(realValue);
                    }
                    if (null!= problem) {
                        // Handle event
                        handler.handleEvent(new org.jvnet.jaxbvalidation.event.ObjectValidationEvent(locatorproblem));
                    }
                }
            } else {
                if (null == value) {
                    // todo: report null
                } else {
                    // Report wrong class
                    handler.handleEvent(new org.jvnet.jaxbvalidation.event.ObjectValidationEvent(locatornew org.jvnet.jaxbvalidation.problem.structure.NonExpectedClassProblem(value.getClass())));
                }
            }
        }
    }
New to GrepCode? Check out our FAQ X