Class CamelCaseBuilder

java.lang.Object
org.simpleframework.xml.stream.CamelCaseBuilder
All Implemented Interfaces:
Style

class CamelCaseBuilder extends Object implements Style
The CamelCaseBuilder is used to represent an XML style that can be applied to a serialized object. A style can be used to modify the element and attribute names for the generated document. This styles can be used to generate camel case XML.
 
    <ExampleElement>
        <ChildElement exampleAttribute='example'>
           <InnerElement>example</InnerElement>
        </ChildElement>
     </ExampleElement>
     
 
Above the camel case XML elements and attributes can be generated from a style implementation. Styles enable the same objects to be serialized in different ways, generating different styles of XML without having to modify the class schema for that object.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private class 
    This is used to parse the style for this builder.
    private class 
    This is used to parse the style for this builder.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final boolean
    If true then the attribute will start with upper case.
    protected final boolean
    If true then the element will start with upper case.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CamelCaseBuilder(boolean element, boolean attribute)
    Constructor for the CamelCaseBuilder object.
  • Method Summary

    Modifier and Type
    Method
    Description
    This is used to generate the XML attribute representation of the specified name.
    This is used to generate the XML element representation of the specified name.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • attribute

      protected final boolean attribute
      If true then the attribute will start with upper case.
    • element

      protected final boolean element
      If true then the element will start with upper case.
  • Constructor Details

    • CamelCaseBuilder

      public CamelCaseBuilder(boolean element, boolean attribute)
      Constructor for the CamelCaseBuilder object. This is used to create a style that will create camel case XML attributes and elements allowing a consistent format for generated XML. Both the attribute an elements are configurable.
      Parameters:
      element - if true the element will start as upper case
      attribute - if true the attribute starts as upper case
  • Method Details

    • getAttribute

      public String getAttribute(String name)
      This is used to generate the XML attribute representation of the specified name. Attribute names should ensure to keep the uniqueness of the name such that two different names will be styled in to two different strings.
      Specified by:
      getAttribute in interface Style
      Parameters:
      name - this is the attribute name that is to be styled
      Returns:
      this returns the styled name of the XML attribute
    • getElement

      public String getElement(String name)
      This is used to generate the XML element representation of the specified name. Element names should ensure to keep the uniqueness of the name such that two different names will be styled in to two different strings.
      Specified by:
      getElement in interface Style
      Parameters:
      name - this is the element name that is to be styled
      Returns:
      this returns the styled name of the XML element