Coverage Report - org.simpleframework.xml.core.Schema
 
Classes in this File Line Coverage Branch Coverage Complexity
Schema
N/A
N/A
1
 
 1  
 /*
 2  
  * Schema.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.core;
 20  
 
 21  
 import org.simpleframework.xml.Version;
 22  
 
 23  
 /**
 24  
  * The <code>Schema</code> object is used to track which fields within
 25  
  * an object have been visited by a converter. This object is necessary
 26  
  * for processing <code>Composite</code> objects. In particular it is
 27  
  * necessary to keep track of which required nodes have been visited 
 28  
  * and which have not, if a required not has not been visited then the
 29  
  * XML source does not match the XML class schema and serialization
 30  
  * must fail before processing any further. 
 31  
  * 
 32  
  * @author Niall Gallagher
 33  
  */ 
 34  
 interface Schema {
 35  
    
 36  
    /**
 37  
     * This is used to determine whether the scanned class represents
 38  
     * a primitive type. A primitive type is a type that contains no
 39  
     * XML annotations and so cannot be serialized with an XML form.
 40  
     * Instead primitives a serialized using transformations.
 41  
     * 
 42  
     * @return this returns true if no XML annotations were found
 43  
     */
 44  
    boolean isPrimitive();
 45  
    
 46  
    /**
 47  
     * This returns the <code>Label</code> that represents the version
 48  
     * annotation for the scanned class. Only a single version can
 49  
     * exist within the class if more than one exists an exception is
 50  
     * thrown. This will read only floating point types such as double.
 51  
     * 
 52  
     * @return this returns the label used for reading the version
 53  
     */
 54  
    Label getVersion();
 55  
    
 56  
    /**
 57  
     * This is the <code>Version</code> for the scanned class. It 
 58  
     * allows the deserialization process to be configured such that
 59  
     * if the version is different from the schema class none of
 60  
     * the fields and methods are required and unmatched elements
 61  
     * and attributes will be ignored.
 62  
     * 
 63  
     * @return this returns the version of the class that is scanned
 64  
     */
 65  
    Version getRevision();
 66  
    
 67  
    /**
 68  
     * This is used to acquire the <code>Decorator</code> for this.
 69  
     * A decorator is an object that adds various details to the
 70  
     * node without changing the overall structure of the node. For
 71  
     * example comments and namespaces can be added to the node with
 72  
     * a decorator as they do not affect the deserialization.
 73  
     * 
 74  
     * @return this returns the decorator associated with this
 75  
     */
 76  
    Decorator getDecorator();
 77  
    
 78  
    /**
 79  
     * This is used to acquire the instantiator for the type. This is
 80  
     * used to create object instances based on the constructors that
 81  
     * have been annotated. If no constructors have been annotated
 82  
     * then this can be used to create default no argument instances.
 83  
     * 
 84  
     * @return this instantiator responsible for creating instances
 85  
     */
 86  
    Instantiator getInstantiator();
 87  
    
 88  
    /**
 89  
     * This is used to acquire the <code>Caller</code> object. This
 90  
     * is used to call the callback methods within the object. If the
 91  
     * object contains no callback methods then this will return an
 92  
     * object that does not invoke any methods that are invoked. 
 93  
     * 
 94  
     * @return this returns the caller for the specified type
 95  
     */
 96  
    Caller getCaller();
 97  
    
 98  
    /**
 99  
     * This is used to acquire the <code>Section</code> that defines
 100  
     * the XML structure for this class schema. A section, is the 
 101  
     * section of XML that the class is represented within. A
 102  
     * section contains all the elements and attributes defined for
 103  
     * the class in a tree like structure.
 104  
     * 
 105  
     * @return this returns the section defined for the schama
 106  
     */
 107  
    Section getSection();
 108  
    
 109  
    /**
 110  
     * This returns the <code>Label</code> that represents the text
 111  
     * annotation for the scanned class. Only a single text annotation
 112  
     * can be used per class, so this returns only a single label
 113  
     * rather than a <code>LabelMap</code> object. Also if this is
 114  
     * not null then the elements label map will be empty.
 115  
     * 
 116  
     * @return this returns the text label for the scanned class
 117  
     */
 118  
    Label getText();
 119  
 }