org.progeeks.meta.xml
Class RendererProxy

java.lang.Object
  extended by org.progeeks.meta.xml.RendererProxy

public class RendererProxy
extends java.lang.Object

Provides access to a property renderer and the specific type that was used to look it up. Frequently, renderers attempting to render their children will need access to this information to better determine how to proceed... and in any case, the specific type should be the one passed to the renderer when the actual rendering is done and without keeping them together this would require a second lookup. This class is provided for renderers and shouldn't normally be used by external callers.

Version:
$Revision: 1.3 $
Author:
Paul Speed

Constructor Summary
RendererProxy(PropertyType type, XmlPropertyRenderer renderer)
           
 
Method Summary
 boolean canRenderAsAttribute(java.lang.Object value)
          Returns true if the specified value can be rendered as an attribute in this context.
 java.lang.String getAsAttribute(java.lang.Object value, XmlRenderContext context)
          Returns the string representation of the specified object as an attribute if supported.
 XmlPropertyRenderer getRenderer()
          Returns the renderer for this proxy.
 PropertyType getType()
          Returns the specific property type that was used to look up this proxy's renderer.
 void render(java.lang.Object value, boolean forceWrap, XmlRenderContext context, boolean registerObject)
          Renders the specified value using the internal renderer and type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RendererProxy

public RendererProxy(PropertyType type,
                     XmlPropertyRenderer renderer)
Method Detail

getType

public PropertyType getType()
Returns the specific property type that was used to look up this proxy's renderer.


getRenderer

public XmlPropertyRenderer getRenderer()
Returns the renderer for this proxy.


canRenderAsAttribute

public boolean canRenderAsAttribute(java.lang.Object value)
Returns true if the specified value can be rendered as an attribute in this context.


getAsAttribute

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


render

public void render(java.lang.Object value,
                   boolean forceWrap,
                   XmlRenderContext context,
                   boolean registerObject)
Renders the specified value using the internal renderer and type.

Parameters:
value - The object to render.
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 - The rendering context for the write session.
registerObject - Set to true if the object should be added to the registry and the appropriate xml.oid attribute emitted. The object will only be registered if it is not already in the registry.


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