Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.impl » inst2xsd » [javadoc | source]

    1   /*   Copyright 2004 The Apache Software Foundation
    2    *
    3    *   Licensed under the Apache License, Version 2.0 (the "License");
    4    *   you may not use this file except in compliance with the License.
    5    *   You may obtain a copy of the License at
    6    *
    7    *       http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    *   Unless required by applicable law or agreed to in writing, software
   10    *   distributed under the License is distributed on an "AS IS" BASIS,
   11    *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12    *   See the License for the specific language governing permissions and
   13    *  limitations under the License.
   14    */
   15   package org.apache.xmlbeans.impl.inst2xsd;
   16   
   17   /**
   18    * @author Cezar Andrei (cezar.andrei at bea.com) Date: Jul 19, 2004
   19   
   20        Options:
   21          * Design
   22             o Russian Doll Design - local elements and local types
   23             o Salami Slice Design - global elements and local types
   24             o Venetian Blind Design - local elements and global complex types
   25          * Simple content types (leafs)
   26             o smart (default) - try to find out the right simple shema type
   27             o always xsd:string
   28          * Use enumeration - when there are multiple valid values in a list
   29             o never
   30             o only if not more than ( 20 ) - number option
   31    */
   32   public class Inst2XsdOptions
   33   {
   34       // design
   35       public static final int DESIGN_RUSSIAN_DOLL   = 1;
   36       public static final int DESIGN_SALAMI_SLICE   = 2;
   37       public static final int DESIGN_VENETIAN_BLIND = 3;
   38   
   39       private int _design = DESIGN_VENETIAN_BLIND;
   40   
   41       // schema type for simple content values
   42       public static final int SIMPLE_CONTENT_TYPES_SMART  = 1;
   43       public static final int SIMPLE_CONTENT_TYPES_STRING = 2;
   44   
   45       private int _simpleContentTypes = SIMPLE_CONTENT_TYPES_SMART;
   46   
   47       // use enumeration
   48       public static final int ENUMERATION_NEVER = 1;
   49       public static final int ENUMERATION_NOT_MORE_THAN_DEFAULT = 10;
   50   
   51       private int _enumerations = ENUMERATION_NOT_MORE_THAN_DEFAULT;
   52   
   53       private boolean _verbose = false;
   54   
   55   
   56       public int getDesign()
   57       {
   58           return _design;
   59       }
   60   
   61       /**
   62        * Design
   63          o Russian Doll Design
   64          o Salami Slice Design
   65          o Venetian Blind Design
   66        * @param designType
   67        * @see #DESIGN_RUSSIAN_DOLL
   68        * @see #DESIGN_SALAMI_SLICE
   69        * @see #DESIGN_VENETIAN_BLIND
   70        */
   71       public void setDesign(int designType)
   72       {
   73           if (designType!=DESIGN_RUSSIAN_DOLL && designType!=DESIGN_SALAMI_SLICE && designType!=DESIGN_VENETIAN_BLIND)
   74               throw new IllegalArgumentException("Unknown value for design type.");
   75           _design = designType;
   76       }
   77   
   78       public boolean isUseEnumerations()
   79       {
   80           return _enumerations>ENUMERATION_NEVER;
   81       }
   82   
   83       public int getUseEnumerations()
   84       {
   85           return _enumerations;
   86       }
   87   
   88       public void setUseEnumerations(int useEnumerations)
   89       {
   90           if (useEnumerations<ENUMERATION_NEVER)
   91               throw new IllegalArgumentException("UseEnumerations must be set to a value bigger than " + ENUMERATION_NEVER);
   92           _enumerations = useEnumerations;
   93       }
   94   
   95       public int getSimpleContentTypes()
   96       {
   97           return _simpleContentTypes;
   98       }
   99   
  100       public void setSimpleContentTypes(int simpleContentTypes)
  101       {
  102           if (simpleContentTypes!=SIMPLE_CONTENT_TYPES_SMART && simpleContentTypes!=SIMPLE_CONTENT_TYPES_STRING)
  103               throw new IllegalArgumentException("Unknown value for simpleContentTypes.");
  104           _simpleContentTypes = simpleContentTypes;
  105       }
  106   
  107       public boolean isVerbose()
  108       {
  109           return _verbose;
  110       }
  111   
  112       public void setVerbose(boolean verbose)
  113       {
  114           _verbose = verbose;
  115       }
  116   }

Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.impl » inst2xsd » [javadoc | source]