|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Objectorg.thymeleaf.fragment.DOMSelectorFragmentSpec
public final class DOMSelectorFragmentSpec
Implementation of the IFragmentSpec interface that extracts fragments
of DOM trees using a DOMSelector object.
The DOM selector instances used by these fragment specs are stored at the
expression cache (see ICacheManager.getExpressionCache()) using
as key DOM_SELECTOR_EXPRESSION_PREFIX + selectorExpression.
Objects of this class are thread-safe.
| Field Summary | |
|---|---|
static String |
DOM_SELECTOR_EXPRESSION_PREFIX
Prefix to be used for keys when storing selector expressions at the expression cache. |
| Constructor Summary | |
|---|---|
DOMSelectorFragmentSpec(String selectorExpression)
Creates a new instance, specifying the expression to be used for a DOMSelector object to be created internally. |
|
DOMSelectorFragmentSpec(String selectorExpression,
boolean returnOnlyChildren)
Creates a new instance, specifying the expression to be used for a DOMSelector object to be created internally and also a flag indicating
whether the selected element itself (or selected elements if more than
one) must be returned or only its/their children. |
|
| Method Summary | |
|---|---|
List<Node> |
extractFragment(Configuration configuration,
List<Node> nodes)
Executes the fragment specification against a list of nodes representing a DOM tree (or a set of trees), returning the extracted nodes. |
String |
getSelectorExpression()
|
boolean |
isReturnOnlyChildren()
Returns whether this spec should only return the children of the selected nodes (true) or the selected nodes themselves (false, default). |
String |
toString()
|
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String DOM_SELECTOR_EXPRESSION_PREFIX
Prefix to be used for keys when storing selector expressions at the expression cache.
| Constructor Detail |
|---|
public DOMSelectorFragmentSpec(String selectorExpression)
Creates a new instance, specifying the expression to be used for a
DOMSelector object to be created internally.
selectorExpression - the expression to be used for the DOM selector.
public DOMSelectorFragmentSpec(String selectorExpression,
boolean returnOnlyChildren)
Creates a new instance, specifying the expression to be used for a
DOMSelector object to be created internally and also a flag indicating
whether the selected element itself (or selected elements if more than
one) must be returned or only its/their children.
If returnOnlyChildren is true, the element with the specified name and/or containing the specified attribute will be discarded, and only its/their children will be returned.
selectorExpression - the expression to be used for the DOM selector.returnOnlyChildren - whether the selected elements should be returned (false),
or only their children (true).| Method Detail |
|---|
public String getSelectorExpression()
public boolean isReturnOnlyChildren()
Returns whether this spec should only return the children of the selected nodes (true) or the selected nodes themselves (false, default).
public final List<Node> extractFragment(Configuration configuration,
List<Node> nodes)
IFragmentSpecExecutes the fragment specification against a list of nodes representing a DOM tree (or a set of trees), returning the extracted nodes.
extractFragment in interface IFragmentSpecconfiguration - the configuration object.nodes - the list of nodes on which to apply extraction.
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||