org.apache.cocoon.selection
Class NamedPatternsSelector
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.selection.NamedPatternsSelector
- All Implemented Interfaces:
- Component, Configurable, LogEnabled, ThreadSafe, Selector
- Direct Known Subclasses:
- BrowserSelector, HostSelector
public abstract class NamedPatternsSelector
- extends AbstractLogEnabled
- implements Configurable, ThreadSafe, Selector
Abstract class for selectors that select a value when it matches
some patterns associated to the select expression.
- Version:
- CVS $Id: NamedPatternsSelector.html 1304258 2012-03-23 10:09:27Z ilgrosso $
- Author:
- Sylvain Wallez
- See Also:
BrowserSelector
,
HostSelector
Fields inherited from interface org.apache.cocoon.selection.Selector |
ROLE |
Method Summary |
protected boolean |
checkPatterns(String expression,
String value)
Checks if value is a (case-sensitive) substring of one of the patterns associated
to expression |
protected boolean |
checkPatterns(String expression,
String value,
boolean caseSensitive)
Checks if value is a substring of one of the patterns associated
to expression |
protected void |
configure(Configuration conf,
String confName,
String nameAttr,
String valueAttr)
Setup the association from expressions to a list of patterns. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.cocoon.selection.Selector |
select |
NamedPatternsSelector
public NamedPatternsSelector()
configure
protected void configure(Configuration conf,
String confName,
String nameAttr,
String valueAttr)
throws ConfigurationException
- Setup the association from expressions to a list of patterns. The configuration
should look like :
<pre>
<map:selector name="foo" src="...">
<confName nameAttr="expression" valueAttr="pattern"/>
... others (expression, pattern) associations ...
</map:selector>
</pre>
- Parameters:
conf
- the configurationconfName
- the name of children of conf
that will be used to
build associationsnameAttr
- the name of the attribute that holds the expressionvalueAttr
- the name of the attribute that holds the pattern
- Throws:
ConfigurationException
checkPatterns
protected boolean checkPatterns(String expression,
String value)
- Checks if
value
is a (case-sensitive) substring of one of the patterns associated
to expression
- Parameters:
expression
- the expression that is selectedvalue
- the value to check
- Returns:
- true if
value
matches one of the patterns
checkPatterns
protected boolean checkPatterns(String expression,
String value,
boolean caseSensitive)
- Checks if
value
is a substring of one of the patterns associated
to expression
- Parameters:
expression
- the expression that is selectedvalue
- the value to checkcaseSensitive
- boolean switch whether comparison is done case-sensitive
- Returns:
- true if
value
matches one of the patterns
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.