Coverage Report - org.simpleframework.xml.Version
 
Classes in this File Line Coverage Branch Coverage Complexity
Version
N/A
N/A
0
 
 1  
 /*
 2  
  * Version.java July 2008
 3  
  *
 4  
  * Copyright (C) 2008, Niall Gallagher <niallg@users.sf.net>
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
 15  
  * implied. See the License for the specific language governing 
 16  
  * permissions and limitations under the License.
 17  
  */
 18  
 
 19  
 package org.simpleframework.xml;
 20  
 
 21  
 import java.lang.annotation.Retention;
 22  
 import java.lang.annotation.RetentionPolicy;
 23  
 
 24  
 /**
 25  
  * The <code>Version</code> annotation is used to specify an attribute
 26  
  * that is used to represent a revision of the class XML schema. This
 27  
  * annotation can annotate only floating point types such as double, 
 28  
  * float, and the java primitive object types. This can not be used to
 29  
  * annotate strings, enumerations or other primitive types.
 30  
  * 
 31  
  * @author Niall Gallagher
 32  
  */
 33  
 @Retention(RetentionPolicy.RUNTIME)
 34  
 public @interface Version {
 35  
    
 36  
    /**
 37  
     * This represents the name of the XML attribute. Annotated fields
 38  
     * or methods can optionally provide the name of the XML attribute
 39  
     * they represent. If a name is not provided then the field or 
 40  
     * method name is used in its place. A name can be specified if 
 41  
     * the field or method name is not suitable for the XML attribute.
 42  
     * 
 43  
     * @return the name of the XML attribute this represents
 44  
     */
 45  
    String name() default "";
 46  
 
 47  
    /**
 48  
     * This represents the revision of the class. A revision is used
 49  
     * by the deserialization process to determine how to match the
 50  
     * annotated fields and methods to the XML elements and attributes.
 51  
     * If the version deserialized is different to the annotated 
 52  
     * revision then annotated fields and methods are not required 
 53  
     * and if there are excessive XML nodes they are ignored.
 54  
     * 
 55  
     * @return this returns the version of the XML class schema
 56  
     */
 57  
    double revision() default 1.0;
 58  
    
 59  
    /**
 60  
     * Determines whether the version is required within an XML
 61  
     * element. Any field marked as not required will not have its
 62  
     * value set when the object is deserialized. This is written
 63  
     * only if the version is not the same as the default version.
 64  
     * 
 65  
     * @return true if the version is required, false otherwise
 66  
     */
 67  
    boolean required() default false;
 68  
 }