Coverage Report - org.simpleframework.xml.core.Criteria
 
Classes in this File Line Coverage Branch Coverage Complexity
Criteria
N/A
N/A
1
 
 1  
 /*
 2  
  * Criteria.java December 2009
 3  
  *
 4  
  * Copyright (C) 2009, 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  
 /**
 22  
  * The <code>Criteria</code> object represents the criteria used to
 23  
  * create an object and populate its methods and fields. This allows
 24  
  * all deserialized information for a single object to be stored in
 25  
  * a single location. All deserialized variables are accessible from
 26  
  * the <code>get</code> method.
 27  
  * 
 28  
  * @author Niall Gallagher
 29  
  */
 30  
 interface Criteria extends Iterable<Object> {
 31  
    
 32  
    /**
 33  
     * This is used to get the <code>Variable</code> that represents
 34  
     * a deserialized object. The variable contains all the meta
 35  
     * data for the field or method and the value that is to be set
 36  
     * on the method or field.
 37  
     * 
 38  
     * @param key this is the key of the variable to be acquired
 39  
     * 
 40  
     * @return this returns the keyed variable if it exists
 41  
     */
 42  
    Variable get(Object key) throws Exception;
 43  
    
 44  
    /**
 45  
     * This is used to get the <code>Variable</code> that represents
 46  
     * a deserialized object. The variable contains all the meta
 47  
     * data for the field or method and the value that is to be set
 48  
     * on the method or field.
 49  
     * 
 50  
     * @param label this is the label to acquire the variable for
 51  
     * 
 52  
     * @return this returns the variable associated with the label
 53  
     */
 54  
    Variable get(Label label) throws Exception;
 55  
    
 56  
    /**
 57  
     * This is used to resolve the <code>Variable</code> by using 
 58  
     * the union names of a label. This will also acquire variables
 59  
     * based on the actual name of the variable.
 60  
     * 
 61  
     * @param path this is the path of the variable to be acquired
 62  
     * 
 63  
     * @return this returns the variable mapped to the path
 64  
     */
 65  
    Variable resolve(String path) throws Exception;
 66  
    
 67  
    /**
 68  
     * This is used to remove the <code>Variable</code> from this
 69  
     * criteria object. When removed, the variable will no longer be
 70  
     * used to set the method or field when the <code>commit</code>
 71  
     * method is invoked.
 72  
     * 
 73  
     * @param key this is the key associated with the variable
 74  
     * 
 75  
     * @return this returns the keyed variable if it exists
 76  
     */
 77  
    Variable remove(Object key) throws Exception;
 78  
    
 79  
    /**
 80  
     * This is used to create a <code>Variable</code> and set it for
 81  
     * this criteria. The variable can be retrieved at a later stage
 82  
     * using the name of the label. This allows for repeat reads as
 83  
     * the variable can be used to acquire the labels converter.
 84  
     * 
 85  
     * @param label this is the label used to create the pointer
 86  
     * @param value this is the value of the object to be read
 87  
     */
 88  
    void set(Label label, Object value) throws Exception;
 89  
    
 90  
    /**
 91  
     * This is used to set the values for the methods and fields of
 92  
     * the specified object. Invoking this performs the population
 93  
     * of an object being deserialized. It ensures that each value 
 94  
     * is set after the XML element has been fully read.
 95  
     * 
 96  
     * @param source this is the object that is to be populated
 97  
     */
 98  
    void commit(Object source) throws Exception;
 99  
 }