Class URLStringConverter
java.lang.Object
org.tquadrat.foundation.util.stringconverter.URLStringConverter
- All Implemented Interfaces:
Serializable, StringConverter<URL>
- Direct Known Subclasses:
EncodedURLStringConverter
@ClassVersion(sourceVersion="$Id: URLStringConverter.java 1157 2025-12-31 14:05:44Z tquadrat $")
@API(status=STABLE,
since="0.0.6")
public sealed class URLStringConverter
extends Object
implements StringConverter<URL>
permits EncodedURLStringConverter
An implementation of
StringConverter
for
URL
values.
The method
fromString(CharSequence)
will use the constructor
URI(String)
and then
URI.toURL()
to create a URL instance from the given value. It requires that the
URL is absolute.
Generally, when dealing with relative URLs, URIs should be used instead.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: URLStringConverter.java 1157 2025-12-31 14:05:44Z tquadrat $
- Since:
- 0.0.6
- See Also:
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.util.stringconverter.URLStringConverter"
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final URLStringConverterAn instance of this class.static final StringThe error message for an invalid URL: "\'%1$s\' cannot be parsed as a valid URL".Fields inherited from interface StringConverter
METHOD_NAME_GetSubjectClass, METHOD_NAME_Provider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromString(CharSequence source) final Collection<Class<?>> Provides the subject class for this converter.static final URLStringConverterprovider()This method is used by theServiceLoaderto obtain the instance for thisStringConverterimplementation.
-
Field Details
-
MSG_InvalidURL
The error message for an invalid URL: "\'%1$s\' cannot be parsed as a valid URL".- See Also:
-
INSTANCE
An instance of this class.
-
-
Constructor Details
-
URLStringConverter
public URLStringConverter()Creates a new instance ofURLStringConverter.
-
-
Method Details
-
fromString
- Specified by:
fromStringin interfaceStringConverter<URL>- 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
-
