info.magnolia.content2bean.impl
Class Content2BeanProcessorImpl

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

@Singleton
public class Content2BeanProcessorImpl
extends Object
implements Content2BeanProcessor

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

Version:
$Id$
Author:
philipp

Nested Class Summary
 
Nested classes/interfaces inherited from interface info.magnolia.content2bean.Content2BeanProcessor
Content2BeanProcessor.Factory
 
Constructor Summary
Content2BeanProcessorImpl(TypeMapping typeMapping)
           
 
Method Summary
 boolean isForceCreation()
           
protected  Content2BeanTransformer resolveTransformer(TypeDescriptor type, Content2BeanTransformer transformer)
           
 void setForceCreation(boolean handleExceptions)
          Deprecated. only used in tests
protected  void setProperties(Map<String,Object> values, Content2BeanTransformer transformer, TransformationState state)
          Populates the properties of the bean with values from the map.
 Object setProperties(Object bean, Content node, boolean recursive, Content2BeanTransformer transformer, ComponentProvider componentProvider)
          Similar to toBean() but uses a passed bean as the root bean.
 Object toBean(Content node, boolean recursive, Content2BeanTransformer transformer, ComponentProvider componentProvider)
          Transforms the node to a bean using the passed transformer and component provider.
protected  Object toBean(Content node, boolean recursive, Content2BeanTransformer transformer, TransformationState state, ComponentProvider componentProvider)
           
protected  Map<String,Object> toMap(Content node, boolean recursive, Content2BeanTransformer transformer, TransformationState state, ComponentProvider componentProvider)
          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

@Inject
public Content2BeanProcessorImpl(TypeMapping typeMapping)
Method Detail

toBean

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

Specified by:
toBean in interface Content2BeanProcessor
Throws:
Content2BeanException

toBean

protected Object toBean(Content node,
                        boolean recursive,
                        Content2BeanTransformer transformer,
                        TransformationState state,
                        ComponentProvider componentProvider)
                 throws Content2BeanException
Throws:
Content2BeanException

setProperties

public Object setProperties(Object bean,
                            Content node,
                            boolean recursive,
                            Content2BeanTransformer transformer,
                            ComponentProvider componentProvider)
                     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 Map<String,Object> toMap(Content node,
                                   boolean recursive,
                                   Content2BeanTransformer transformer,
                                   TransformationState state,
                                   ComponentProvider componentProvider)
                            throws Content2BeanException
Transforms the children of provided content into a map.

Throws:
Content2BeanException

setProperties

protected void setProperties(Map<String,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)
Deprecated. only used in tests



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