org.progeeks.meta.xml
Class DefaultXmlPropertyRenderer

java.lang.Object
  extended by org.progeeks.meta.xml.AbstractXmlPropertyRenderer
      extended by org.progeeks.meta.xml.DefaultXmlPropertyRenderer
All Implemented Interfaces:
XmlPropertyRenderer
Direct Known Subclasses:
StringXmlPropertyRenderer

public class DefaultXmlPropertyRenderer
extends AbstractXmlPropertyRenderer

Renders a single XML property by looking an appropriate property format.

Version:
$Revision: 1.9 $
Author:
Paul Speed

Constructor Summary
DefaultXmlPropertyRenderer()
           
 
Method Summary
 boolean canRenderAsAttribute(java.lang.Object value, PropertyType type)
          Returns true if the property value can be rendered as an attribute.
 boolean getAlwaysWrap()
          Returns true if this renderer should always wrap its rendered values in a class tag.
 java.lang.String getAsAttribute(java.lang.Object value, PropertyType type, XmlRenderContext context)
          Returns the string representation of the specified object as an attribute.
 void render(java.lang.Object value, PropertyType type, boolean forceWrap, XmlRenderContext context)
          Renders the specified Mutator's value to the specified writer.
 void setAlwaysWrap(boolean wrap)
          Set to true if this renderer should always wrap its rendered values in a class tag.
 
Methods inherited from class org.progeeks.meta.xml.AbstractXmlPropertyRenderer
findEm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultXmlPropertyRenderer

public DefaultXmlPropertyRenderer()
Method Detail

setAlwaysWrap

public void setAlwaysWrap(boolean wrap)
Set to true if this renderer should always wrap its rendered values in a class tag. False if it should take its hint from the forceWrap attribute on the render method.


getAlwaysWrap

public boolean getAlwaysWrap()
Returns true if this renderer should always wrap its rendered values in a class tag. False if it should take its hint from the forceWrap attribute on the render method.


canRenderAsAttribute

public boolean canRenderAsAttribute(java.lang.Object value,
                                    PropertyType type)
Returns true if the property value can be rendered as an attribute. Default implementation always returns true.

Specified by:
canRenderAsAttribute in interface XmlPropertyRenderer
Overrides:
canRenderAsAttribute in class AbstractXmlPropertyRenderer

getAsAttribute

public java.lang.String getAsAttribute(java.lang.Object value,
                                       PropertyType type,
                                       XmlRenderContext context)
Returns the string representation of the specified object as an attribute.

Specified by:
getAsAttribute in interface XmlPropertyRenderer
Overrides:
getAsAttribute in class AbstractXmlPropertyRenderer

render

public void render(java.lang.Object value,
                   PropertyType type,
                   boolean forceWrap,
                   XmlRenderContext context)
Renders the specified Mutator's value to the specified writer.

Specified by:
render in interface XmlPropertyRenderer
Specified by:
render in class AbstractXmlPropertyRenderer
Parameters:
value - The value to be rendered.
type - The specific type that was used to lookup this renderer.
forceWrap - Set to true if the renderer should wrap the value in its own style of start/end tags. False indicates that the renderer can optionally leave them out. This is usually used by renderers that support types that can be defined as strings directly.
context - Contains the rendering output information for this session.


Copyright © 2002-2003 Paul Speed. All Rights Reserved.