Module org.tquadrat.foundation.util
Class CharSequenceStringConverter
java.lang.Object
org.tquadrat.foundation.util.stringconverter.CharSequenceStringConverter
- All Implemented Interfaces:
Serializable,StringConverter<CharSequence>
@ClassVersion(sourceVersion="$Id: CharSequenceStringConverter.java 1060 2023-09-24 19:21:40Z tquadrat $")
@API(status=STABLE,
since="0.0.6")
public final class CharSequenceStringConverter
extends Object
implements StringConverter<CharSequence>
The implementation of
StringConverter
for
CharSequence
values.
Although a conversion from CharSequence to String is redundant
(at best), this implementation exists for cases where a string converter is
retrieved based on the data type; it can simplify the code when no special
case must be considered for CharSequence.
Obviously, the method
fromString()
will not necessarily return an instance of the exact type that may have
been used with
toString();
it will return an instance of
String,
as that is the best matching implementation of CharSequence for
this purpose.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: CharSequenceStringConverter.java 1060 2023-09-24 19:21:40Z tquadrat $
- Since:
- 0.1.0
- See Also:
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.util.stringconverter.CharSequenceStringConverter"
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CharSequenceStringConverterAn instance of this class.Fields inherited from interface org.tquadrat.foundation.lang.StringConverter
METHOD_NAME_GetSubjectClass, METHOD_NAME_Provider -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofCharSequenceStringConverter. -
Method Summary
Modifier and TypeMethodDescriptionfinal CharSequencefromString(CharSequence source) final Collection<Class<CharSequence>> Provides the subject class for this converter.static final CharSequenceStringConverterprovider()This method is used by theServiceLoaderto obtain the instance for thisStringConverterimplementation.final StringtoString(CharSequence source)
-
Field Details
-
INSTANCE
An instance of this class.
-
-
Constructor Details
-
CharSequenceStringConverter
public CharSequenceStringConverter()Creates a new instance ofCharSequenceStringConverter.
-
-
Method Details
-
fromString
- Specified by:
fromStringin interfaceStringConverter<CharSequence>- Throws:
IllegalArgumentException
-
getSubjectClass
Provides the subject class for this converter.- Returns:
- The subject class.
-
provider
This method is used by theServiceLoaderto obtain the instance for thisStringConverterimplementation.- Returns:
- The instance for this
StringConverterimplementation.
-
toString
- Specified by:
toStringin interfaceStringConverter<CharSequence>
-
