Coverage Report - org.simpleframework.xml.Root
 
Classes in this File Line Coverage Branch Coverage Complexity
Root
N/A
N/A
0
 
 1  
 /*
 2  
  * Root.java July 2006
 3  
  *
 4  
  * Copyright (C) 2006, 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.RetentionPolicy;
 22  
 import java.lang.annotation.Retention;
 23  
 
 24  
 /**
 25  
  * This <code>Root</code> annotation is used to annotate classes that
 26  
  * need to be serialized. Also, elements within an element list, as
 27  
  * represented by the <code>ElementList</code> annotation need this
 28  
  * annotation so that the element names can be determined. All other
 29  
  * field or method names can be determined using the annotation and 
 30  
  * so the <code>Root</code> annotation is not needed for such objects. 
 31  
  * 
 32  
  * @author Niall Gallagher
 33  
  */
 34  
 @Retention(RetentionPolicy.RUNTIME)
 35  
 public @interface Root {
 36  
   
 37  
    /**
 38  
     * This represents the name of the XML element. This is optional
 39  
     * an is used when the name of the class is not suitable as an
 40  
     * element name. If this is not specified then the name of the
 41  
     * XML element will be the name of the class. If specified the
 42  
     * class will be serialized and deserialized with the given name.
 43  
     * 
 44  
     * @return the name of the XML element this represents
 45  
     */
 46  
    String name() default "";
 47  
 
 48  
    /**
 49  
     * This is used to determine whether the object represented
 50  
     * should be parsed in a strict manner. Strict parsing requires
 51  
     * that each element and attribute in the XML document match a 
 52  
     * field in the class schema. If an element or attribute does
 53  
     * not match a field then the parsing fails with an exception.
 54  
     * Setting strict parsing to false allows details within the
 55  
     * source XML document to be skipped during deserialization.
 56  
     * 
 57  
     * @return true if strict parsing is enabled, false otherwise
 58  
     */ 
 59  
    boolean strict() default true;
 60  
 }