< prev index next >

src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CEnumLeafInfo.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  36 import com.sun.tools.internal.xjc.model.nav.NType;
  37 import com.sun.tools.internal.xjc.outline.Aspect;
  38 import com.sun.tools.internal.xjc.outline.Outline;
  39 import com.sun.xml.internal.bind.v2.model.annotation.Locatable;
  40 import com.sun.xml.internal.bind.v2.model.core.EnumLeafInfo;
  41 import com.sun.xml.internal.bind.v2.model.core.ID;
  42 import com.sun.xml.internal.bind.v2.model.core.NonElement;
  43 import com.sun.xml.internal.bind.v2.model.core.Element;
  44 import com.sun.xml.internal.bind.v2.runtime.Location;
  45 import com.sun.xml.internal.xsom.XSComponent;
  46 import com.sun.xml.internal.xsom.XmlString;
  47 
  48 import org.xml.sax.Locator;
  49 
  50 /**
  51  * Transducer that converts a string into an "enumeration class."
  52  *
  53  * The structure of the generated class needs to precisely
  54  * follow the JAXB spec.
  55  *
  56  * @author
  57  *    <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
  58  */
  59 public final class CEnumLeafInfo implements EnumLeafInfo<NType,NClass>, NClass, CNonElement
  60 {
  61     /**
  62      * The {@link Model} object to which this bean belongs.
  63      */
  64     public final Model model;
  65 
  66     /**
  67      * The parent into which the enum class should be generated.
  68      */
  69     public final CClassInfoParent parent;
  70 
  71     /**
  72      * Short name of the generated type-safe enum.
  73      */
  74     public final String shortName;
  75 
  76     private final QName typeName;
  77 
  78     private final XSComponent source;
  79 
  80     /**
  81      * Represents the underlying type of this enumeration
  82      * and its conversion.
  83      *
  84      * <p>
  85      * To parse XML into a constant, we use the base type
  86      * to do lexical -> value, then use a map to pick up the right one.
  87      *
  88      * <p>
  89      * Hence this also represents the type of the Java value.
  90      * For example, if this is an enumeration of xs:int,
  91      * then this field will be Java int.
  92      */
  93     public final CNonElement base;
  94 
  95 
  96     /**
  97      * List of enum members.
  98      */
  99     public final Collection<CEnumConstant> members;
 100 
 101     private final CCustomizations customizations;
 102 
 103     /**
 104      * @see #getLocator()
 105      */
 106     private final Locator sourceLocator;


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  36 import com.sun.tools.internal.xjc.model.nav.NType;
  37 import com.sun.tools.internal.xjc.outline.Aspect;
  38 import com.sun.tools.internal.xjc.outline.Outline;
  39 import com.sun.xml.internal.bind.v2.model.annotation.Locatable;
  40 import com.sun.xml.internal.bind.v2.model.core.EnumLeafInfo;
  41 import com.sun.xml.internal.bind.v2.model.core.ID;
  42 import com.sun.xml.internal.bind.v2.model.core.NonElement;
  43 import com.sun.xml.internal.bind.v2.model.core.Element;
  44 import com.sun.xml.internal.bind.v2.runtime.Location;
  45 import com.sun.xml.internal.xsom.XSComponent;
  46 import com.sun.xml.internal.xsom.XmlString;
  47 
  48 import org.xml.sax.Locator;
  49 
  50 /**
  51  * Transducer that converts a string into an "enumeration class."
  52  *
  53  * The structure of the generated class needs to precisely
  54  * follow the JAXB spec.
  55  *
  56  * @author Kohsuke KAWAGUCHI

  57  */
  58 public final class CEnumLeafInfo implements EnumLeafInfo<NType,NClass>, NClass, CNonElement
  59 {
  60     /**
  61      * The {@link Model} object to which this bean belongs.
  62      */
  63     public final Model model;
  64 
  65     /**
  66      * The parent into which the enum class should be generated.
  67      */
  68     public final CClassInfoParent parent;
  69 
  70     /**
  71      * Short name of the generated type-safe enum.
  72      */
  73     public final String shortName;
  74 
  75     private final QName typeName;
  76 
  77     private final XSComponent source;
  78 
  79     /**
  80      * Represents the underlying type of this enumeration
  81      * and its conversion.
  82      *
  83      * <p>
  84      * To parse XML into a constant, we use the base type
  85      * to do {@code lexical -> value}, then use a map to pick up the right one.
  86      *
  87      * <p>
  88      * Hence this also represents the type of the Java value.
  89      * For example, if this is an enumeration of xs:int,
  90      * then this field will be Java int.
  91      */
  92     public final CNonElement base;
  93 
  94 
  95     /**
  96      * List of enum members.
  97      */
  98     public final Collection<CEnumConstant> members;
  99 
 100     private final CCustomizations customizations;
 101 
 102     /**
 103      * @see #getLocator()
 104      */
 105     private final Locator sourceLocator;


< prev index next >