All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.tools.xjc.reader.xmlschema.bindinfo.binding.rng Maven / Gradle / Ivy

Go to download

JAXB Binding Compiler. Contains source code needed for binding customization files into java sources. In other words: the *tool* to generate java classes for the given xml representation.

There is a newer version: 4.0.5
Show newest version




]>


  
  
    import com.sun.codemodel.*;
    import com.sun.tools.xjc.generator.bean.field.*;
    import com.sun.tools.xjc.model.*;
    import org.glassfish.jaxb.core.api.impl.NameConverter;
    import org.glassfish.jaxb.core.v2.WellKnownNamespace;
    import org.glassfish.jaxb.core.marshaller.SAX2DOMEx;
    import com.sun.tools.xjc.reader.xmlschema.bindinfo.*;
    import com.sun.tools.xjc.reader.Const;
    import org.xml.sax.*;
    import org.w3c.dom.Document;
    import org.xml.sax.helpers.DefaultHandler;
    import java.util.*;
    import javax.xml.namespace.QName;
    import javax.xml.parsers.ParserConfigurationException;
  
  
  
    
      
      
      
      
    
  
  
  
  
    
    
      import java.io.StringWriter;
      import org.glassfish.jaxb.core.marshaller.DataWriter;
    
    
      // customization declarations
      public BindInfo bi;
      
      private StringWriter w;

      private SAX2DOMEx sax2dom;
    
    
    
      bi = new BindInfo($runtime.copyLocator());
      $runtime.currentBindInfo = bi;
      
      
      
        
          
            
            
              
                
                  result = 
                  bi.addDecl(result);
                
                
                  
                    
                    
                    
                  

                  if($runtime.isExtensionURI($uri)) {
                    // parse this sub-tree as an extension
                    try {
                      sax2dom = new SAX2DOMEx();
                    } catch( ParserConfigurationException e ) {
                      throw new Error(e); // impossible
                    }
                    $runtime.redirectSubtree(sax2dom,$uri,$localName,$qname);
                  } else {
                    // ignore this sub-tree
                    sax2dom = null;
                    $runtime.redirectSubtree(new DefaultHandler(),$uri,$localName,$qname);
                  }
                  
                  
                  if(sax2dom!=null) {
                    bi.addDecl(new BIXPluginCustomization(((Document)sax2dom.getDOM()).getDocumentElement(),$runtime.copyLocator()));
                  }
                
                
              
            
          
          
          
            
            
              
                
                  msg = 
                  bi.appendDocumentation($runtime.truncateDocComment(msg),true);
                
                
                  
                    
                    w = new StringWriter();
                    DataWriter xw = new DataWriter(w,"UTF-8");
                    xw.setXmlDecl(false);
                    $runtime.redirectSubtree(xw,$uri,$localName,$qname);
                    
                    
                  
                  "+
                    $runtime.escapeMarkup($runtime.truncateDocComment(w.toString()))+
                    "
", false ); w=null; ]]> private BIDeclaration result; result = result = result = result = result = result = result = private Locator loc; private Map globalConvs = new HashMap(); private NameConverter nameConverter = NameConverter.standard; private String enableJavaNamingConvention = "true"; private String fixedAttrToConstantProperty = "false"; private String needIsSetMethod = "false"; private String simpleTypeSubstitution = "false"; private boolean flattenClasses = false; private Set enumBaseTypes = new HashSet(); private int defaultEnumSizeCap = 256; private boolean generateEnumMemberName = false; private boolean choiceContentPropertyWithModelGroupBinding = false; private boolean xSmartWildcardDefaultBinding = false; private boolean xSimpleMode; private boolean generateValueClass = true; private boolean generateElementClass = false; private boolean generateMixedExtensions = false; public BIGlobalBinding makeResult() { if( enumBaseTypes.size()==0 ) enumBaseTypes.add(new QName(WellKnownNamespace.XML_SCHEMA,"NCName")); // defaults to NCName return new BIGlobalBinding( globalConvs,nameConverter, choiceContentPropertyWithModelGroupBinding, generateValueClass, generateElementClass, $runtime.parseBoolean(enableJavaNamingConvention), $runtime.parseBoolean(fixedAttrToConstantProperty), $runtime.parseBoolean(needIsSetMethod), $runtime.parseBoolean(simpleTypeSubstitution), generateEnumMemberName, flattenClasses, enumBaseTypes, defaultEnumSizeCap, ct, serializable, xSuperClass, xSuperInterface, xSimpleMode, xSmartWildcardDefaultBinding, loc); } loc = $runtime.copyLocator(); asWordSeparator asCharInWord nameConverter = NameConverter.jaxrpcCompatible; enableJavaNamingConvention = fixedAttrToConstantProperty = needIsSetMethod = simpleTypeSubstitution = nested flattenClasses = false; toplevel flattenClasses = true; ct = generateError generateName generateEnumMemberName = true; value = QName qn = $runtime.parseQName(value); enumBaseTypes.add( qn ); value = defaultEnumSizeCap = Integer.parseInt(value); value = choiceContentPropertyWithModelGroupBinding = $runtime.parseBoolean(value); value = generateValueClass = $runtime.parseBoolean(value); value = generateElementClass = $runtime.parseBoolean(value); value = generateMixedExtensions = $runtime.parseBoolean(value); value = if( $runtime.parseBoolean(value)==true ) $runtime.reportUnsupportedFeature("enableValidation"); value = if( $runtime.parseBoolean(value)==true ) $runtime.reportUnsupportedFeature("enableFailFastCheck"); xmlType = conv = globalConvs.put( $runtime.parseQName(xmlType), conv ); serialuid = if(serialuid!=null) serializable = new BISerializable(Long.parseLong(serialuid)); else serializable = new BISerializable(null); serializable = xSuperClass = xSuperInterface = xSmartWildcardDefaultBinding = true; xSimpleMode = true; private Locator loc; public BISchemaBinding makeResult() { return new BISchemaBinding(packageName,javadoc,tt,et,at,mt,nt,loc); } loc = $runtime.copyLocator(); packageName = javadoc = tt = et = at = mt = nt = private String prefix=""; private String suffix=""; prefix = suffix = javadoc = javadoc = $runtime.truncateDocComment(javadoc); private FieldRenderer r = null; type = if( type.equals("indexed") ) r = FieldRenderer.ARRAY; else try { r = new UntypedListFieldRenderer( $runtime.codeModel.ref(type) ); } catch( ClassNotFoundException e ) { throw new NoClassDefFoundError(e.getMessage()); } private Locator loc; public BIClass makeResult() { return new BIClass(loc,name,implClass,javadoc); } loc = $runtime.copyLocator(); javadoc = name = implClass = private Locator loc; private Boolean isConst = null; private Boolean isSet = null; private Boolean genElemProp = null; public BIProperty makeResult() throws SAXException { JType baseTypeRef = null; if(baseType!=null) baseTypeRef = $runtime.getType(baseType); return new BIProperty(loc,name,javadoc,baseTypeRef,conv,ct,isConst,isSet,genElemProp); } loc = $runtime.copyLocator(); name = baseType = ct = isConstStr = isConst = $runtime.parseBoolean(isConstStr)?Boolean.TRUE:Boolean.FALSE; isSetStr = isSet = $runtime.parseBoolean(isSetStr)?Boolean.TRUE:Boolean.FALSE; genElemPropStr = genElemProp = $runtime.parseBoolean(genElemPropStr)?Boolean.TRUE:Boolean.FALSE; failFast = if( $runtime.parseBoolean(failFast) ) { $runtime.reportUnimplementedFeature("generateFailFastSetterMethod"); } javadoc = conv = r = import com.sun.tools.xjc.generator.util.WhitespaceNormalizer; parse = print = _context = context = $runtime.parseBoolean(_context); import java.util.HashMap; private HashMap members = new HashMap(); private boolean dontBind = false; private Locator loc,loc2; private BIEnum makeResult() { return new BIEnum(loc,dontBind,name,javadoc,members); } loc = $runtime.copyLocator(); false dontBind = true; name = javadoc = jname = null; javadoc = null; loc2 = $runtime.copyLocator(); jname = value = javadoc = members.put( value, new BIEnumMember(loc2,jname,javadoc) ); private Locator loc; private BIEnumMember makeResult() { return new BIEnumMember(loc,name,javadoc); } loc = $runtime.copyLocator(); name = javadoc = private JDefinedClass makeResult() { try { JDefinedClass c = $runtime.codeModel._class(name); c.hide(); return c; } catch( JClassAlreadyExistsException e ) { return e.getExistingClass(); } } name = private JDefinedClass makeResult() { try { JDefinedClass c = $runtime.codeModel._class(name,ClassType.INTERFACE); c.hide(); return c; } catch( JClassAlreadyExistsException e ) { return e.getExistingClass(); } } name = private long uid = 1; private BISerializable makeResult() { return new BISerializable(uid); } // loc = $runtime.copyLocator(); v = uid = Long.parseLong(v); complex



© 2015 - 2024 Weber Informatics LLC | Privacy Policy