Coverage Report - org.simpleframework.xml.core.MethodType
 
Classes in this File Line Coverage Branch Coverage Complexity
MethodType
100%
9/9
N/A
1
 
 1  
 /*
 2  
  * MethodType.java May 2007
 3  
  *
 4  
  * Copyright (C) 2007, 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>MethodType</code> enumeration is used to specify a 
 23  
  * set of types that can be used to classify Java Beans methods.
 24  
  * This creates three types for the get, is, and set methods. The
 25  
  * method types allow the <code>MethodScanner</code> to determine
 26  
  * what function the method has in creating a contact point for
 27  
  * the object. This also enables methods to be parsed correctly.
 28  
  * 
 29  
  * @author Niall Gallagher
 30  
  * 
 31  
  * @see org.simpleframework.xml.core.MethodScanner
 32  
  * @see org.simpleframework.xml.core.MethodPart
 33  
  */
 34  1
 enum MethodType {
 35  
    
 36  
    /**
 37  
     * This is used to represent a method that acts as a getter.
 38  
     */
 39  1
    GET(3),
 40  
    
 41  
    /**
 42  
     * This is used to represent a method that acts as a getter.
 43  
     */
 44  1
    IS(2),
 45  
    
 46  
    /**
 47  
     * This is used to represent a method that acts as a setter.
 48  
     */
 49  1
    SET(3),  
 50  
    
 51  
    /**
 52  
     * This is used to represent a a normal method to be ignored.
 53  
     */
 54  1
    NONE(0);
 55  
    
 56  
    /**
 57  
     * This is the length of the prefix the method type uses.
 58  
     */
 59  
    private int prefix;
 60  
    
 61  
    /**
 62  
     * Constructor for the <code>MethodType</code> object. This is
 63  
     * used to create a method type specifying the length of the
 64  
     * prefix. This allows the method name to be parsed easily.
 65  
     * 
 66  
     * @param prefix this is the length of the method name prefix
 67  
     */
 68  4
    private MethodType(int prefix) {
 69  4
       this.prefix = prefix;
 70  4
    }
 71  
    
 72  
    /**
 73  
     * This is used to acquire the prefix for the method type. The
 74  
     * prefix allows the method name to be extracted easily as it
 75  
     * is used to determine the character range that forms the name.
 76  
     * 
 77  
     * @return this returns the method name prefix for the type
 78  
     */
 79  
    public int getPrefix() {
 80  534
       return prefix;
 81  
    }
 82  
 }