info.magnolia.content2bean
Class Content2BeanUtil

java.lang.Object
  extended by info.magnolia.content2bean.Content2BeanUtil

public class Content2BeanUtil
extends java.lang.Object

Utility class for content to bean transformations. In case you do not have to customize the transformation, you should use one of these methods:

Version:
$Id: Content2BeanUtil.java 36506 2010-08-18 12:05:34Z had $
Author:
philipp

Nested Class Summary
static class Content2BeanUtil.DefaultClassTransformer
          Provide a default class.
 
Field Summary
static Content2BeanTransformerImpl TO_MAP_TRANSFORMER
          Transforms all nodes to a map.
 
Constructor Summary
Content2BeanUtil()
           
 
Method Summary
static void addCollectionPropertyMapping(java.lang.Class type, java.lang.String name, java.lang.Class mappedType)
           
static Bean2ContentProcessor getBean2ContentProcessor()
          Get the current processor.
static Content2BeanProcessor getContent2BeanProcessor()
          Get the current processor.
static Content2BeanTransformer getContent2BeanTransformer()
          Get the current transformer.
static TypeMapping getTypeMapping()
          Get the current mapping.
static void setNodeDatas(Content node, java.util.Map map)
          TODO use the Bean2ContentProcessor.
static void setNodeDatas(Content node, java.lang.Object obj)
          TODO use the Bean2ContentProcessor.
static void setNodeDatas(Content node, java.lang.Object bean, java.lang.String[] excludes)
          TODO use the Bean2ContentProcessor.
static java.lang.Object setProperties(java.lang.Object bean, Content node)
           
static java.lang.Object setProperties(java.lang.Object bean, Content node, boolean recursive)
           
static java.lang.Object setProperties(java.lang.Object bean, Content node, boolean recursive, java.lang.Class defaultClass)
           
static java.lang.Object setProperties(java.lang.Object bean, Content node, boolean recursive, Content2BeanTransformer transformer)
           
static java.lang.Object toBean(Content node)
           
static java.lang.Object toBean(Content node, boolean recursive)
           
static java.lang.Object toBean(Content node, boolean recursive, java.lang.Class defaultClass)
           
static java.lang.Object toBean(Content node, boolean recursive, Content2BeanTransformer transformer)
           
static java.lang.Object toBean(Content node, java.lang.Class defaultClass)
           
static java.util.Map toMap(Content node)
          Transforms the nodes data into a map containing the names and values.
static java.util.Map toMap(Content node, boolean recursive)
          Transforms the nodes data into a map containing the names and values.
static java.util.Map toMap(Content node, boolean recursive, java.lang.Class defaultClass)
           
static java.util.Map toPureMaps(Content node, boolean recursive)
          Transforms the nodes data into a map containing the names and values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TO_MAP_TRANSFORMER

public static final Content2BeanTransformerImpl TO_MAP_TRANSFORMER
Transforms all nodes to a map.

Constructor Detail

Content2BeanUtil

public Content2BeanUtil()
Method Detail

getContent2BeanProcessor

public static Content2BeanProcessor getContent2BeanProcessor()
Get the current processor.


getBean2ContentProcessor

public static Bean2ContentProcessor getBean2ContentProcessor()
Get the current processor.


getTypeMapping

public static TypeMapping getTypeMapping()
Get the current mapping.


getContent2BeanTransformer

public static Content2BeanTransformer getContent2BeanTransformer()
Get the current transformer.


toBean

public static java.lang.Object toBean(Content node)
                               throws Content2BeanException
Throws:
Content2BeanException
See Also:
Content2BeanProcessor

toBean

public static java.lang.Object toBean(Content node,
                                      java.lang.Class defaultClass)
                               throws Content2BeanException
Throws:
Content2BeanException
See Also:
Content2BeanProcessor

toBean

public static java.lang.Object toBean(Content node,
                                      boolean recursive,
                                      java.lang.Class defaultClass)
                               throws Content2BeanException
Throws:
Content2BeanException
See Also:
Content2BeanProcessor

toBean

public static java.lang.Object toBean(Content node,
                                      boolean recursive)
                               throws Content2BeanException
Throws:
Content2BeanException
See Also:
Content2BeanProcessor

toBean

public static java.lang.Object toBean(Content node,
                                      boolean recursive,
                                      Content2BeanTransformer transformer)
                               throws Content2BeanException
Throws:
Content2BeanException
See Also:
Content2BeanProcessor

toMap

public static java.util.Map toMap(Content node)
                           throws Content2BeanException
Transforms the nodes data into a map containing the names and values.

Returns:
a flat map
Throws:
Content2BeanException

toMap

public static java.util.Map toMap(Content node,
                                  boolean recursive)
                           throws Content2BeanException
Transforms the nodes data into a map containing the names and values. In case recursive is true the sub-nodes are transformed to beans using the transformer. To avoid that use toMaps() instead

Throws:
Content2BeanException

toMap

public static java.util.Map toMap(Content node,
                                  boolean recursive,
                                  java.lang.Class defaultClass)
                           throws Content2BeanException
Throws:
Content2BeanException

toPureMaps

public static java.util.Map toPureMaps(Content node,
                                       boolean recursive)
                                throws Content2BeanException
Transforms the nodes data into a map containing the names and values. In case recursive is true the sub-nodes are transformed to maps as well

Throws:
Content2BeanException

setProperties

public static java.lang.Object setProperties(java.lang.Object bean,
                                             Content node)
                                      throws Content2BeanException
Throws:
Content2BeanException
See Also:
Content2BeanProcessor

setProperties

public static java.lang.Object setProperties(java.lang.Object bean,
                                             Content node,
                                             boolean recursive)
                                      throws Content2BeanException
Throws:
Content2BeanException
See Also:
Content2BeanProcessor

setProperties

public static java.lang.Object setProperties(java.lang.Object bean,
                                             Content node,
                                             boolean recursive,
                                             java.lang.Class defaultClass)
                                      throws Content2BeanException
Throws:
Content2BeanException

setProperties

public static java.lang.Object setProperties(java.lang.Object bean,
                                             Content node,
                                             boolean recursive,
                                             Content2BeanTransformer transformer)
                                      throws Content2BeanException
Throws:
Content2BeanException
See Also:
Content2BeanProcessor

addCollectionPropertyMapping

public static void addCollectionPropertyMapping(java.lang.Class type,
                                                java.lang.String name,
                                                java.lang.Class mappedType)
See Also:
Content2BeanProcessor

setNodeDatas

public static void setNodeDatas(Content node,
                                java.lang.Object bean,
                                java.lang.String[] excludes)
                         throws Content2BeanException
TODO use the Bean2ContentProcessor.

Throws:
Content2BeanException

setNodeDatas

public static void setNodeDatas(Content node,
                                java.lang.Object obj)
                         throws Content2BeanException
TODO use the Bean2ContentProcessor.

Throws:
Content2BeanException

setNodeDatas

public static void setNodeDatas(Content node,
                                java.util.Map map)
                         throws Content2BeanException
TODO use the Bean2ContentProcessor.

Throws:
Content2BeanException


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