Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [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   
   16   package org.apache.xmlbeans;
   17   
   18   import javax.xml.namespace.QName;
   19   import java.util.List;
   20   import java.util.Date;
   21   import java.util.Calendar;
   22   import java.math.BigInteger;
   23   import java.math.BigDecimal;
   24   
   25   /**
   26    * All XmlObject implementations can be coerced to SimpleValue.
   27    * For any given schema type, only a subset of the conversion
   28    * methods will work.  Others will throw an exception.
   29    * <p>
   30    * SimpleValue is useful for declaring variables which can hold
   31    * more than one similar schema type that may not happen to
   32    * have a common XML base type, for example, two list types,
   33    * or two unrelated integer restrictions that happen to fit
   34    * into an int.
   35    */
   36   public interface SimpleValue extends XmlObject
   37   {
   38       /**
   39        * The same as getSchemaType unless this is a union instance
   40        * or nil value.
   41        * <p>
   42        * For unions, this returns the non-union consituent type of
   43        * this instance. This type may change if setters are called
   44        * that cause the instance to change to another constituent
   45        * type of the union.
   46        * <p>
   47        * For nil values, this returns null.
   48        */
   49       SchemaType instanceType();
   50   
   51       /** Returns the value as a {@link String}. */
   52       String getStringValue();
   53       /** Returns the value as a boolean. */
   54       boolean getBooleanValue();
   55       /** Returns the value as a byte. */
   56       public byte getByteValue();
   57       /** Returns the value as a short. */
   58       public short getShortValue();
   59       /** Returns the value as an int. */
   60       public int getIntValue();
   61       /** Returns the value as a long. */
   62       public long getLongValue();
   63       /** Returns the value as a {@link BigInteger}. */
   64       public BigInteger getBigIntegerValue();
   65       /** Returns the value as a {@link BigDecimal}. */
   66       public BigDecimal getBigDecimalValue();
   67       /** Returns the value as a float. */
   68       public float getFloatValue();
   69       /** Returns the value as a double. */
   70       public double getDoubleValue();
   71       /** Returns the value as a byte array. */
   72       byte[] getByteArrayValue();
   73       /** Returns the value as a {@link StringEnumAbstractBase}. */
   74       StringEnumAbstractBase getEnumValue();
   75       /** Returns the value as a {@link Calendar}. */
   76       Calendar getCalendarValue();
   77       /** Returns the value as a {@link Date}. */
   78       Date getDateValue();
   79       /** Returns the value as a {@link GDate}. */
   80       GDate getGDateValue();
   81       /** Returns the value as a {@link GDuration}. */
   82       GDuration getGDurationValue();
   83       /** Returns the value as a {@link QName}. */
   84       QName getQNameValue();
   85       /** Returns the value as a {@link List} of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). */
   86       List getListValue();
   87       /** Returns the value as a {@link List} of XmlAnySimpleType objects. */
   88       List xgetListValue();
   89   
   90       /** Returns a union value as a its natural friendly Java object (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). */
   91       Object getObjectValue();
   92   
   93       // following are simple type value setters
   94   
   95       /** Sets the value as a {@link String}. */
   96       void setStringValue(String obj);
   97       /** Sets the value as a boolean. */
   98       void setBooleanValue(boolean v);
   99       /** Sets the value as a byte. */
  100       void setByteValue(byte v);
  101       /** Sets the value as a short. */
  102       void setShortValue(short v);
  103       /** Sets the value as an int. */
  104       void setIntValue(int v);
  105       /** Sets the value as a long. */
  106       void setLongValue(long v);
  107       /** Sets the value as a {@link BigInteger}. */
  108       void setBigIntegerValue(BigInteger obj);
  109       /** Sets the value as a {@link BigDecimal}. */
  110       void setBigDecimalValue(BigDecimal obj);
  111       /** Sets the value as a float. */
  112       void setFloatValue(float v);
  113       /** Sets the value as a double. */
  114       void setDoubleValue(double v);
  115       /** Sets the value as a byte array. */
  116       void setByteArrayValue(byte[] obj);
  117       /** Sets the value as a {@link StringEnumAbstractBase}. */
  118       void setEnumValue(StringEnumAbstractBase obj);
  119       /** Sets the value as a {@link Calendar}. */
  120       void setCalendarValue(Calendar obj);
  121       /** Sets the value as a {@link Date}. */
  122       void setDateValue(Date obj);
  123       /** Sets the value as a {@link GDate}. */
  124       void setGDateValue(GDate obj);
  125       /** Sets the value as a {@link GDuration}. */
  126       void setGDurationValue(GDuration obj);
  127       /** Sets the value as a {@link QName}. */
  128       void setQNameValue(QName obj);
  129       /** Sets the value as a {@link List}. */
  130       void setListValue(List obj);
  131       /** Sets the value as an arbitrary {@link Object}. */
  132       void setObjectValue(Object obj);
  133   
  134       /**
  135        * Returns the value as a {@link String}. *
  136        * @deprecated replaced with {@link #getStringValue}
  137        */
  138       String stringValue();
  139       /**
  140        * Returns the value as a boolean. *
  141        * @deprecated replaced with {@link #getBooleanValue}
  142        */
  143       boolean booleanValue();
  144       /**
  145        * Returns the value as a byte. *
  146        * @deprecated replaced with {@link #getByteValue}
  147        */
  148       public byte byteValue();
  149       /**
  150        * Returns the value as a short. *
  151        * @deprecated replaced with {@link #getShortValue}
  152        */
  153       public short shortValue();
  154       /**
  155        * Returns the value as an int. *
  156        * @deprecated replaced with {@link #getIntValue}
  157        */
  158       public int intValue();
  159       /**
  160        * Returns the value as a long. *
  161        * @deprecated replaced with {@link #getLongValue}
  162        */
  163       public long longValue();
  164       /**
  165        * Returns the value as a {@link BigInteger}. *
  166        * @deprecated replaced with {@link #getBigIntegerValue}
  167        */
  168       public BigInteger bigIntegerValue();
  169       /**
  170        * Returns the value as a {@link BigDecimal}. *
  171        * @deprecated replaced with {@link #getBigDecimalValue}
  172        */
  173       public BigDecimal bigDecimalValue();
  174       /**
  175        * Returns the value as a float. *
  176        * @deprecated replaced with {@link #getFloatValue}
  177        */
  178       public float floatValue();
  179       /**
  180        * Returns the value as a double. *
  181        * @deprecated replaced with {@link #getDoubleValue}
  182        */
  183       public double doubleValue();
  184       /**
  185        * Returns the value as a byte array. *
  186        * @deprecated replaced with {@link #getByteArrayValue}
  187        */
  188       byte[] byteArrayValue();
  189       /**
  190        * Returns the value as a {@link StringEnumAbstractBase}. *
  191        * @deprecated replaced with {@link #getEnumValue}
  192        */
  193       StringEnumAbstractBase enumValue();
  194       /**
  195        * Returns the value as a {@link Calendar}. *
  196        * @deprecated replaced with {@link #getCalendarValue}
  197        */
  198       Calendar calendarValue();
  199       /**
  200        * Returns the value as a {@link Date}. *
  201        * @deprecated replaced with {@link #getDateValue}
  202        */
  203       Date dateValue();
  204       /**
  205        * Returns the value as a {@link GDate}. *
  206        * @deprecated replaced with {@link #getGDateValue}
  207        */
  208       GDate gDateValue();
  209       /**
  210        * Returns the value as a {@link GDuration}. *
  211        * @deprecated replaced with {@link #getGDurationValue}
  212        */
  213       GDuration gDurationValue();
  214       /**
  215        * Returns the value as a {@link QName}. *
  216        * @deprecated replaced with {@link #getQNameValue}
  217        */
  218       QName qNameValue();
  219       /**
  220        * Returns the value as a {@link List} of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). *
  221        * @deprecated replaced with {@link #getListValue}
  222        */
  223       List listValue();
  224       /**
  225        * Returns the value as a {@link List} of XmlAnySimpleType objects. *
  226        * @deprecated replaced with {@link #xgetListValue}
  227        */
  228       List xlistValue();
  229       
  230       /**
  231        * Returns a union value as a its natural friendly Java object (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). *
  232        * @deprecated replaced with {@link #getObjectValue}
  233        */
  234       Object objectValue();
  235   
  236       // following are simple type value setters
  237   
  238       /**
  239        * Sets the value as a {@link String}. *
  240        * @deprecated replaced with {@link #setStringValue}
  241        */
  242       void set(String obj);
  243       /**
  244        * Sets the value as a boolean. *
  245        * @deprecated replaced with {@link #setBooleanValue}
  246        */
  247       void set(boolean v);
  248       /**
  249        * Sets the value as a byte.
  250        * @deprecated replaced with {@link #setByteValue}
  251        **/
  252       void set(byte v);
  253       /**
  254        * Sets the value as a short.
  255        * @deprecated replaced with {@link #setShortValue}
  256        **/
  257       void set(short v);
  258       /**
  259        * Sets the value as an int.
  260        * @deprecated replaced with {@link #setIntValue}
  261        **/
  262       void set(int v);
  263       /**
  264        * Sets the value as a long.
  265        * @deprecated replaced with {@link #setLongValue}
  266        **/
  267       void set(long v);
  268       /**
  269        * Sets the value as a {@link BigInteger}.
  270        * @deprecated replaced with {@link #setBigIntegerValue}
  271        **/
  272       void set(BigInteger obj);
  273       /**
  274        * Sets the value as a {@link BigDecimal}
  275        * @deprecated replaced with {@link #setBigDecimalValue}
  276        **/
  277       void set(BigDecimal obj);
  278       /**
  279        * Sets the value as a float.
  280        * @deprecated replaced with {@link #setFloatValue}
  281        **/
  282       void set(float v);
  283       /**
  284        * Sets the value as a double.
  285        * @deprecated replaced with {@link #setDoubleValue}
  286        **/
  287       void set(double v);
  288       /**
  289        * Sets the value as a byte array.
  290        * @deprecated replaced with {@link #setByteArrayValue}
  291        **/
  292       void set(byte[] obj);
  293       /**
  294        * Sets the value as a {@link StringEnumAbstractBase}.
  295        * @deprecated replaced with {@link #setEnumValue}
  296        **/
  297       void set(StringEnumAbstractBase obj);
  298       /**
  299        * Sets the value as a {@link Calendar}.
  300        * @deprecated replaced with {@link #setCalendarValue}
  301        **/
  302       void set(Calendar obj);
  303       /**
  304        * Sets the value as a {@link Date}.
  305        * @deprecated replaced with {@link #setDateValue}
  306        **/
  307       void set(Date obj);
  308       /**
  309        * Sets the value as a {@link GDate}.
  310        * @deprecated replaced with {@link #setGDateValue}
  311        **/
  312       void set(GDateSpecification obj);
  313       /**
  314        * Sets the value as a {@link GDuration}.
  315        * @deprecated replaced with {@link #setGDurationValue}
  316        **/
  317       void set(GDurationSpecification obj);
  318       /**
  319        * Sets the value as a {@link QName}.
  320        * @deprecated replaced with {@link #setQNameValue}
  321        **/
  322       void set(QName obj);
  323       /**
  324        * Sets the value as a {@link List}.
  325        * @deprecated replaced with {@link #setListValue}
  326        **/
  327       void set(List obj);
  328       /**
  329        * Sets the value as an arbitrary {@link Object}.
  330        * @deprecated replaced with {@link #setObjectValue}
  331        **/
  332       void objectSet(Object obj);
  333   }

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