Coverage Report - org.simpleframework.xml.stream.Style
 
Classes in this File Line Coverage Branch Coverage Complexity
Style
N/A
N/A
1
 
 1  
 /*
 2  
  * Style.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.stream;
 20  
 
 21  
 /**
 22  
  * The <code>Style</code> interface is used to represent an XML style
 23  
  * that can be applied to a serialized object. A style can be used to
 24  
  * modify the element and attribute names for the generated document.
 25  
  * Styles can be used to generate hyphenated or camel case XML.
 26  
  * <pre>
 27  
  * 
 28  
  *    &lt;example-element&gt;
 29  
  *        &lt;child-element example-attribute='example'&gt;
 30  
  *           &lt;inner-element&gt;example&lt;/inner-element&gt;
 31  
  *        &lt;/child-element&gt;
 32  
  *     &lt;/example-element&gt;
 33  
  *     
 34  
  * </pre>
 35  
  * Above the hyphenated XML elements and attributes can be generated
 36  
  * from a style implementation. Styles enable the same objects to be
 37  
  * serialized in different ways, generating different styles of XML
 38  
  * without having to modify the class schema for that object.    
 39  
  * 
 40  
  * @author Niall Gallagher
 41  
  */
 42  
 public interface Style {
 43  
   
 44  
    /**
 45  
     * This is used to generate the XML element representation of 
 46  
     * the specified name. Element names should ensure to keep the
 47  
     * uniqueness of the name such that two different names will
 48  
     * be styled in to two different strings.
 49  
     * 
 50  
     * @param name this is the element name that is to be styled
 51  
     * 
 52  
     * @return this returns the styled name of the XML element
 53  
     */
 54  
    String getElement(String name);
 55  
    
 56  
    /**
 57  
     * This is used to generate the XML attribute representation of 
 58  
     * the specified name. Attribute names should ensure to keep the
 59  
     * uniqueness of the name such that two different names will
 60  
     * be styled in to two different strings.
 61  
     * 
 62  
     * @param name this is the attribute name that is to be styled
 63  
     * 
 64  
     * @return this returns the styled name of the XML attribute
 65  
     */
 66  
    String getAttribute(String name);
 67  
 }