Class AbstractParser
java.lang.Object
de.hybris.platform.commons.translator.parsers.AbstractParser
- Direct Known Subclasses:
HtmlSimpleEntityParser,HtmlSimpleParser
Abstract class for all translators parsers Parsers are classes used to search for special parts of text (usually html
tags) and then to produce
AbstractNodes from them. AbstractParser keep information about regular expression that should be
used to search for these special parts of text and contain mechanism how to create node from them.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractParser(String name, String start, String end) Constructor forAbstractParser -
Method Summary
Modifier and TypeMethodDescriptionabstract AbstractNodecreateNode(String start, String end, String text, Translator translator) CreateAbstractNodeinstance from a given textgetEnd()abstract StringgetEndExpression(String start) getName()getStart()abstract Stringabstract Stringvoidvoidvoid
-
Field Details
-
start
expression used to find starting tag -
end
expression used to find closing tag -
name
parser name, this name should be given to created node
-
-
Constructor Details
-
AbstractParser
public AbstractParser() -
AbstractParser
Constructor forAbstractParser- Parameters:
name- parser namestart- regular expression that would be used to find beginning of text from which node has to be createdend- regular expression that would be used to find end of text from which node has to be created
-
-
Method Details
-
getEnd
- Returns:
- the end
-
setEnd
- Parameters:
end- the end to set
-
getStart
- Returns:
- the start
-
setStart
- Parameters:
start- the start to set
-
getName
- Returns:
- the name
-
setName
- Parameters:
name- the name to set
-
getStartExpression
- Returns:
- regular expression that would be used to search for beginning of text from which node would be created
-
getStartEndExpression
- Returns:
- regular expression that would be used to check if beginning of text is not also the finishing one ( like br html tag which have no separate closing tag)
-
getEndExpression
- Returns:
- regular expression that would be used to search for closing tag for a given start expression.
-
createNode
public abstract AbstractNode createNode(String start, String end, String text, Translator translator) CreateAbstractNodeinstance from a given text- Parameters:
start- is a String that was found when searching for a start of text that should be used to create nodeend- is a String that was found when searching for a end of text that should be used to create nodetext- text is whole text that was between start and end Stringstranslator- reference toTranslatorthat would be used to search for sub tags in giventext- Returns:
- node that was created from the given text (can be with subnodes if any was found in
text)
-