Adding a method to chain translators together. I've gone back and forth on the name, currently with() is my preference. So you could say: BASIC_XML.with(HTML4_ENTITIES). cf LANG-505
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@788243 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a027b12acf
commit
a11f380774
|
@ -103,6 +103,17 @@ public abstract class CharSequenceTranslator {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to create a merger of this translator with another set of
|
||||
* translators. Useful in customizing the standard functionality.
|
||||
*/
|
||||
public final CharSequenceTranslator with(CharSequenceTranslator... translators) {
|
||||
CharSequenceTranslator[] newArray = new CharSequenceTranslator[translators.length + 1];
|
||||
newArray[0] = this;
|
||||
System.arraycopy(translators, 0, newArray, 1, translators.length);
|
||||
return new AggregateTranslator(newArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns an upper case hexadecimal <code>String</code> for the given
|
||||
* character.</p>
|
||||
|
|
Loading…
Reference in New Issue