org.specrunner.source.text
Class FeaturePresenter

java.lang.Object
  extended by org.specrunner.source.text.FeaturePresenter
All Implemented Interfaces:
Serializable, IResetable, IPresenter

public class FeaturePresenter
extends Object
implements IPresenter

Perform conversion of an object Feature to a Node.

Author:
Thiago Santos
See Also:
Serialized Form

Constructor Summary
FeaturePresenter()
           
 
Method Summary
 nu.xom.Node asNode(Object obj, Object... args)
           
 String asString(Object obj, Object... args)
           
protected  void dumpCall(nu.xom.Element root, String name)
          Dump the macro call.
protected  void dumpDescription(nu.xom.Element root, String keyword, NamedSentences description, String tag)
          Dump description.
protected  void dumpExamples(nu.xom.Element root, Keywords words, ScenarioOutline outline, String name)
          Dump the scenario examples.
protected  void dumpExecutableList(nu.xom.Element root, List<Sentence> list, boolean replace)
          Dump an executable list.
protected  nu.xom.Node dumpFeature(nu.xom.Element root, Keywords words, Feature feature)
          Dump feature to root node.
protected  void dumpIterator(nu.xom.Element root, String name)
          Dump the iterator to call examples.
protected  void dumpList(nu.xom.Element root, List<Sentence> list)
          Dump a list.
protected  String dumpMacro(nu.xom.Element root, Keywords words, Scenario scenario)
          Dump the scenario as a macro from SpecRunner core.
protected  void dumpMap(nu.xom.Element root, ScenarioOutline outline)
          Dump example table as a mapping with attributes named.
protected  void dumpMultiScenario(nu.xom.Element root, Keywords words, ScenarioOutline scenario)
          Dump scenario outlines.
protected  void dumpScenario(nu.xom.Element root, Keywords words, Scenario scenario)
          Dump a scenario.
 void dumpSingleScenario(nu.xom.Element root, Keywords words, Scenario scenario)
          Dump a scenario without examples.
protected  void dumpTable(nu.xom.Element root, DataTable data, boolean example)
          Dump table information.
 void initialize()
           
protected  String normalize(String text)
          Prepare placeholders.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeaturePresenter

public FeaturePresenter()
Method Detail

initialize

public void initialize()
Specified by:
initialize in interface IResetable

asNode

public nu.xom.Node asNode(Object obj,
                          Object... args)
Specified by:
asNode in interface IPresenter

dumpFeature

protected nu.xom.Node dumpFeature(nu.xom.Element root,
                                  Keywords words,
                                  Feature feature)
Dump feature to root node.

Parameters:
root - The node.
words - The keyword mapping.
feature - The feature.
Returns:
The node.

dumpDescription

protected void dumpDescription(nu.xom.Element root,
                               String keyword,
                               NamedSentences description,
                               String tag)
Dump description.

Parameters:
root - The node.
keyword - The keyword.
description - The content object.
tag - The tag to be added.

dumpList

protected void dumpList(nu.xom.Element root,
                        List<Sentence> list)
Dump a list.

Parameters:
root - The node.
list - The list to dump.

dumpScenario

protected void dumpScenario(nu.xom.Element root,
                            Keywords words,
                            Scenario scenario)
Dump a scenario.

Parameters:
root - The node.
words - The keyword mapping.
scenario - The scenario.

dumpMultiScenario

protected void dumpMultiScenario(nu.xom.Element root,
                                 Keywords words,
                                 ScenarioOutline scenario)
Dump scenario outlines.

Parameters:
root - The node.
words - The keyword mapping.
scenario - The scenario outline.

dumpMacro

protected String dumpMacro(nu.xom.Element root,
                           Keywords words,
                           Scenario scenario)
Dump the scenario as a macro from SpecRunner core.

Parameters:
root - The root.
words - The words.
scenario - The scenario.
Returns:
The newly created macro name.

dumpExecutableList

protected void dumpExecutableList(nu.xom.Element root,
                                  List<Sentence> list,
                                  boolean replace)
Dump an executable list.

Parameters:
root - The node.
list - The executable list.
replace - Flga to replace > and < by their corresponding in SR.

normalize

protected String normalize(String text)
Prepare placeholders.

Parameters:
text - The text to adjust.
Returns:
The placeholder adjusted.

dumpExamples

protected void dumpExamples(nu.xom.Element root,
                            Keywords words,
                            ScenarioOutline outline,
                            String name)
Dump the scenario examples.

Parameters:
root - The node.
words - The keyword mapping.
outline - The scenario outline.
name - The macro name.

dumpMap

protected void dumpMap(nu.xom.Element root,
                       ScenarioOutline outline)
Dump example table as a mapping with attributes named.

Parameters:
root - The root.
outline - The scenario outline.

dumpTable

protected void dumpTable(nu.xom.Element root,
                         DataTable data,
                         boolean example)
Dump table information.

Parameters:
root - The root node.
data - The table.
example - Indicate if table is a example mapping or outline or not.

dumpIterator

protected void dumpIterator(nu.xom.Element root,
                            String name)
Dump the iterator to call examples.

Parameters:
root - The node.
name - The macro name.

dumpCall

protected void dumpCall(nu.xom.Element root,
                        String name)
Dump the macro call.

Parameters:
root - The root.
name - The macro name.

dumpSingleScenario

public void dumpSingleScenario(nu.xom.Element root,
                               Keywords words,
                               Scenario scenario)
Dump a scenario without examples.

Parameters:
root - The node.
words - The keyword mapping.
scenario - The scenario.

asString

public String asString(Object obj,
                       Object... args)
Specified by:
asString in interface IPresenter


Copyright © 2015. All rights reserved.