info.magnolia.content2bean.impl
Class Content2BeanProcessorImpl

java.lang.Object
  extended by info.magnolia.content2bean.impl.Content2BeanProcessorImpl
All Implemented Interfaces:
Content2BeanProcessor

public class Content2BeanProcessorImpl
extends java.lang.Object
implements Content2BeanProcessor

Contains the logic for traversing the hierarchy and do the calls to the transformer.

Version:
$Id: Content2BeanProcessorImpl.java 41137 2011-01-06 18:19:25Z gjoseph $
Author:
philipp

Nested Class Summary
 
Nested classes/interfaces inherited from interface info.magnolia.content2bean.Content2BeanProcessor
Content2BeanProcessor.Factory
 
Constructor Summary
Content2BeanProcessorImpl()
           
 
Method Summary
 boolean isForceCreation()
           
protected  Content2BeanTransformer resolveTransformer(TypeDescriptor type, Content2BeanTransformer transformer)
           
 void setForceCreation(boolean handleExceptions)
           
protected  void setProperties(java.util.Map<java.lang.String,java.lang.Object> values, Content2BeanTransformer transformer, TransformationState state)
          Populates the properties of the bean with values from the map.
 java.lang.Object setProperties(java.lang.Object bean, Content node, boolean recursive, Content2BeanTransformer transformer)
          Similar to toBean() but uses a passed bean as the root bean.
 java.lang.Object toBean(Content node, boolean recursive, Content2BeanTransformer transformer)
          Transforms the node to a bean using the passed transformer.
protected  java.lang.Object toBean(Content node, boolean recursive, Content2BeanTransformer transformer, TransformationState state)
           
protected  java.util.Map<java.lang.String,java.lang.Object> toMap(Content node, boolean recursive, Content2BeanTransformer transformer, TransformationState state)
          Transforms the children of provided content into a map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Content2BeanProcessorImpl

public Content2BeanProcessorImpl()
Method Detail

toBean

public java.lang.Object toBean(Content node,
                               boolean recursive,
                               Content2BeanTransformer transformer)
                        throws Content2BeanException
Description copied from interface: Content2BeanProcessor
Transforms the node to a bean using the passed transformer.

Specified by:
toBean in interface Content2BeanProcessor
Throws:
Content2BeanException

toBean

protected java.lang.Object toBean(Content node,
                                  boolean recursive,
                                  Content2BeanTransformer transformer,
                                  TransformationState state)
                           throws Content2BeanException
Throws:
Content2BeanException

setProperties

public java.lang.Object setProperties(java.lang.Object bean,
                                      Content node,
                                      boolean recursive,
                                      Content2BeanTransformer transformer)
                               throws Content2BeanException
Description copied from interface: Content2BeanProcessor
Similar to toBean() but uses a passed bean as the root bean.

Specified by:
setProperties in interface Content2BeanProcessor
Throws:
Content2BeanException

toMap

protected java.util.Map<java.lang.String,java.lang.Object> toMap(Content node,
                                                                 boolean recursive,
                                                                 Content2BeanTransformer transformer,
                                                                 TransformationState state)
                                                          throws Content2BeanException
Transforms the children of provided content into a map.

Throws:
Content2BeanException

setProperties

protected void setProperties(java.util.Map<java.lang.String,java.lang.Object> values,
                             Content2BeanTransformer transformer,
                             TransformationState state)
                      throws Content2BeanException
Populates the properties of the bean with values from the map. TODO in case the bean is a map / collection the transfomer.setProperty() method should be called too TODO if the bean has not a certain property but a value is present, transformer.setProperty() should be called with a fake property descriptor

Throws:
Content2BeanException

resolveTransformer

protected Content2BeanTransformer resolveTransformer(TypeDescriptor type,
                                                     Content2BeanTransformer transformer)

isForceCreation

public boolean isForceCreation()

setForceCreation

public void setForceCreation(boolean handleExceptions)


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