SafeUriString class
A string wrapped as an object of type {@link SafeUri}.
This class is package-private and intended for internal use by the {@link com.google.gwt.safehtml} package.
All implementors must implement .equals and .hashCode so that they operate just like String.equals() and String.hashCode().
class SafeUriString implements SafeUri { String _uri; /** * Constructs a {@link SafeUriString} from a string. Callers are responsible * for ensuring that the string passed as the argument to this constructor * satisfies the constraints of the contract imposed by the {@link SafeUri} * interface. * * @param uri the string to be wrapped as a {@link SafeUri} */ SafeUriString(this._uri) { assert(this._uri != null); } /** * {@inheritDoc} */ String asString() { return _uri; } /** * Compares this string to the specified object. */ bool operator ==(Object obj) { if (!(obj is SafeUri)) { return false; } return (obj as SafeUri).asString() == _uri; } /** * Returns a hash code for this string. */ int get hashCode => _uri.hashCode; }
Implements
Constructors
new SafeUriString(String _uri) #
Constructs a {@link SafeUriString} from a string. Callers are responsible for ensuring that the string passed as the argument to this constructor satisfies the constraints of the contract imposed by the {@link SafeUri} interface.
@param uri the string to be wrapped as a {@link SafeUri}
SafeUriString(this._uri) { assert(this._uri != null); }
Properties
final int hashCode #
Returns a hash code for this string.
int get hashCode => _uri.hashCode;
Operators
bool operator ==(Object obj) #
Compares this string to the specified object.
bool operator ==(Object obj) { if (!(obj is SafeUri)) { return false; } return (obj as SafeUri).asString() == _uri; }
Methods
String asString() #
{@inheritDoc}
String asString() { return _uri; }