Class AbstractParser
- java.lang.Object
-
- de.hybris.platform.commons.translator.parsers.AbstractParser
-
- Direct Known Subclasses:
HtmlSimpleEntityParser
,HtmlSimpleParser
public abstract class AbstractParser extends java.lang.Object
Abstract class for all translators parsers Parsers are classes used to search for special parts of text (usually html tags) and then to produce
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.AbstractNode
s
-
-
Constructor Summary
Constructors Constructor Description AbstractParser()
AbstractParser(java.lang.String name, java.lang.String start, java.lang.String end)
Constructor forAbstractParser
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AbstractNode
createNode(java.lang.String start, java.lang.String end, java.lang.String text, Translator translator)
CreateAbstractNode
instance from a given textjava.lang.String
getEnd()
abstract java.lang.String
getEndExpression(java.lang.String start)
java.lang.String
getName()
java.lang.String
getStart()
abstract java.lang.String
getStartEndExpression()
abstract java.lang.String
getStartExpression()
void
setEnd(java.lang.String end)
void
setName(java.lang.String name)
void
setStart(java.lang.String start)
-
-
-
Constructor Detail
-
AbstractParser
public AbstractParser()
-
AbstractParser
public AbstractParser(java.lang.String name, java.lang.String start, java.lang.String end)
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 Detail
-
getEnd
public java.lang.String getEnd()
- Returns:
- the end
-
setEnd
public void setEnd(java.lang.String end)
- Parameters:
end
- the end to set
-
getStart
public java.lang.String getStart()
- Returns:
- the start
-
setStart
public void setStart(java.lang.String start)
- Parameters:
start
- the start to set
-
getName
public java.lang.String getName()
- Returns:
- the name
-
setName
public void setName(java.lang.String name)
- Parameters:
name
- the name to set
-
getStartExpression
public abstract java.lang.String getStartExpression()
- Returns:
- regular expression that would be used to search for beginning of text from which node would be created
-
getStartEndExpression
public abstract java.lang.String 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
public abstract java.lang.String getEndExpression(java.lang.String start)
- Returns:
- regular expression that would be used to search for closing tag for a given start expression.
-
createNode
public abstract AbstractNode createNode(java.lang.String start, java.lang.String end, java.lang.String text, Translator translator)
CreateAbstractNode
instance 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 toTranslator
that 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
)
-
-