Class AggregateCharSequence
- Object
-
- org.thymeleaf.util.AggregateCharSequence
-
- All Implemented Interfaces:
Serializable
,CharSequence
,IWritableCharSequence
public final class AggregateCharSequence extends Object implements Serializable, IWritableCharSequence
Character sequence that aggregates one or several
CharSequence
objects, without the need to clone them or convert them to String.Special implementation of the
CharSequence
interface that can replaceString
objects wherever a specific text literal is composed of several parts and we want to avoid creating newString
objects for them, using instead objects of this class that simply keep an array of references to the original CharSequences.Note that any mutable
CharSequence
implementations used to build objects of this class should never be modified after the creation of the aggregated object.This class is thread-safe
- Since:
- 3.0.0
- Author:
- Daniel Fernández
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description AggregateCharSequence(CharSequence component)
AggregateCharSequence(CharSequence[] components)
AggregateCharSequence(CharSequence component0, CharSequence component1)
AggregateCharSequence(CharSequence component0, CharSequence component1, CharSequence component2)
AggregateCharSequence(CharSequence component0, CharSequence component1, CharSequence component2, CharSequence component3)
AggregateCharSequence(CharSequence component0, CharSequence component1, CharSequence component2, CharSequence component3, CharSequence component4)
AggregateCharSequence(List<? extends CharSequence> components)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char
charAt(int index)
boolean
contentEquals(CharSequence cs)
boolean
contentEquals(StringBuffer sb)
boolean
equals(Object o)
int
hashCode()
int
length()
CharSequence
subSequence(int beginIndex, int endIndex)
String
toString()
void
write(Writer writer)
Write the contents of this char sequence directly to an outputWriter
.
-
-
-
Field Detail
-
serialVersionUID
protected static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AggregateCharSequence
public AggregateCharSequence(CharSequence component)
-
AggregateCharSequence
public AggregateCharSequence(CharSequence component0, CharSequence component1)
-
AggregateCharSequence
public AggregateCharSequence(CharSequence component0, CharSequence component1, CharSequence component2)
-
AggregateCharSequence
public AggregateCharSequence(CharSequence component0, CharSequence component1, CharSequence component2, CharSequence component3)
-
AggregateCharSequence
public AggregateCharSequence(CharSequence component0, CharSequence component1, CharSequence component2, CharSequence component3, CharSequence component4)
-
AggregateCharSequence
public AggregateCharSequence(CharSequence[] components)
-
AggregateCharSequence
public AggregateCharSequence(List<? extends CharSequence> components)
-
-
Method Detail
-
length
public int length()
- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAt
in interfaceCharSequence
-
subSequence
public CharSequence subSequence(int beginIndex, int endIndex)
- Specified by:
subSequence
in interfaceCharSequence
-
write
public void write(Writer writer) throws IOException
Description copied from interface:IWritableCharSequence
Write the contents of this char sequence directly to an output
Writer
.This method can avoid the need to create a
String
object containing all the contents in this character sequence just when we want to write it to aWriter
.- Specified by:
write
in interfaceIWritableCharSequence
- Parameters:
writer
- the writer to write the character sequence to.- Throws:
IOException
- if an input/output exception happens during writing
-
contentEquals
public boolean contentEquals(StringBuffer sb)
-
contentEquals
public boolean contentEquals(CharSequence cs)
-
toString
public String toString()
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
-