info.magnolia.freemarker.models
Class ContentModel

java.lang.Object
  extended by info.magnolia.freemarker.models.ContentModel
All Implemented Interfaces:
freemarker.template.AdapterTemplateModel, freemarker.template.TemplateHashModel, freemarker.template.TemplateHashModelEx, freemarker.template.TemplateModel, freemarker.template.TemplateNodeModel, freemarker.template.TemplateScalarModel

public class ContentModel
extends java.lang.Object
implements freemarker.template.TemplateHashModelEx, freemarker.template.TemplateNodeModel, freemarker.template.TemplateScalarModel, freemarker.template.AdapterTemplateModel

A wrapper for Content nodes. Exposes properties using an HashModel (.property, ?size, ...) a hierarchy (TemplateNodeModel: ?children, ?parent, ...) and as a scalar (returns the node name)

Version:
$Revision: $ ($Author: $)
Author:
Chris Miner, gjoseph

Field Summary
 
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
 
Fields inherited from interface freemarker.template.TemplateScalarModel
EMPTY_STRING
 
Method Summary
 Content asContent()
           
 freemarker.template.TemplateModel get(java.lang.String key)
           
 java.lang.Object getAdaptedObject(java.lang.Class hint)
           
 java.lang.String getAsString()
           
 freemarker.template.TemplateSequenceModel getChildNodes()
          This returns all children, except nodes or jcr: types and mgnl:metaData.
 java.lang.String getNodeName()
           
 java.lang.String getNodeNamespace()
           
 java.lang.String getNodeType()
           
 freemarker.template.TemplateNodeModel getParentNode()
           
 boolean isEmpty()
           
 freemarker.template.TemplateCollectionModel keys()
           
 int size()
           
 freemarker.template.TemplateCollectionModel values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAsString

public java.lang.String getAsString()
Specified by:
getAsString in interface freemarker.template.TemplateScalarModel

get

public freemarker.template.TemplateModel get(java.lang.String key)
                                      throws freemarker.template.TemplateModelException
Specified by:
get in interface freemarker.template.TemplateHashModel
Throws:
freemarker.template.TemplateModelException

isEmpty

public boolean isEmpty()
                throws freemarker.template.TemplateModelException
Specified by:
isEmpty in interface freemarker.template.TemplateHashModel
Throws:
freemarker.template.TemplateModelException

size

public int size()
         throws freemarker.template.TemplateModelException
Specified by:
size in interface freemarker.template.TemplateHashModelEx
Throws:
freemarker.template.TemplateModelException

keys

public freemarker.template.TemplateCollectionModel keys()
                                                 throws freemarker.template.TemplateModelException
Specified by:
keys in interface freemarker.template.TemplateHashModelEx
Throws:
freemarker.template.TemplateModelException

values

public freemarker.template.TemplateCollectionModel values()
                                                   throws freemarker.template.TemplateModelException
Specified by:
values in interface freemarker.template.TemplateHashModelEx
Throws:
freemarker.template.TemplateModelException

getParentNode

public freemarker.template.TemplateNodeModel getParentNode()
                                                    throws freemarker.template.TemplateModelException
Specified by:
getParentNode in interface freemarker.template.TemplateNodeModel
Throws:
freemarker.template.TemplateModelException

getChildNodes

public freemarker.template.TemplateSequenceModel getChildNodes()
                                                        throws freemarker.template.TemplateModelException
This returns all children, except nodes or jcr: types and mgnl:metaData.

Specified by:
getChildNodes in interface freemarker.template.TemplateNodeModel
Throws:
freemarker.template.TemplateModelException

getNodeName

public java.lang.String getNodeName()
                             throws freemarker.template.TemplateModelException
Specified by:
getNodeName in interface freemarker.template.TemplateNodeModel
Throws:
freemarker.template.TemplateModelException

getNodeType

public java.lang.String getNodeType()
                             throws freemarker.template.TemplateModelException
Specified by:
getNodeType in interface freemarker.template.TemplateNodeModel
Throws:
freemarker.template.TemplateModelException

getNodeNamespace

public java.lang.String getNodeNamespace()
                                  throws freemarker.template.TemplateModelException
Specified by:
getNodeNamespace in interface freemarker.template.TemplateNodeModel
Throws:
freemarker.template.TemplateModelException

asContent

public Content asContent()

getAdaptedObject

public java.lang.Object getAdaptedObject(java.lang.Class hint)
Specified by:
getAdaptedObject in interface freemarker.template.AdapterTemplateModel


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.