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
CharSequenceobjects, without the need to clone them or convert them to String.Special implementation of the
CharSequenceinterface that can replaceStringobjects wherever a specific text literal is composed of several parts and we want to avoid creating newStringobjects for them, using instead objects of this class that simply keep an array of references to the original CharSequences.Note that any mutable
CharSequenceimplementations 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 longserialVersionUID
-
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 charcharAt(int index)booleancontentEquals(CharSequence cs)booleancontentEquals(StringBuffer sb)booleanequals(Object o)inthashCode()intlength()CharSequencesubSequence(int beginIndex, int endIndex)StringtoString()voidwrite(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:
lengthin interfaceCharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfaceCharSequence
-
subSequence
public CharSequence subSequence(int beginIndex, int endIndex)
- Specified by:
subSequencein interfaceCharSequence
-
write
public void write(Writer writer) throws IOException
Description copied from interface:IWritableCharSequenceWrite the contents of this char sequence directly to an output
Writer.This method can avoid the need to create a
Stringobject containing all the contents in this character sequence just when we want to write it to aWriter.- Specified by:
writein 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:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-
-