com.google.gwt.safehtml.shared

## Class SafeHtmlString

- java.lang.Object
- - com.google.gwt.safehtml.shared.SafeHtmlString

All Implemented Interfaces:
  SafeHtml, java.io.Serializable

    class SafeHtmlString
    extends java.lang.Object
    implements SafeHtml

A string wrapped as an object of type `SafeHtml`.

This class is package-private and intended for internal use by the `com.google.gwt.safehtml` package.

All implementors must implement .equals and .hashCode so that they operate just like String.equals() and String.hashCode().

### Constructor Summary

Constructors
Constructor and Description
`SafeHtmlString(java.lang.String html)` Constructs a `SafeHtmlString` from a string.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.String` `asString()` Returns this object's contained HTML as a string.
`boolean` `equals(java.lang.Object obj)` Compares this string to the specified object.
`int` `hashCode()` Returns a hash code for this string.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### SafeHtmlString

    SafeHtmlString(java.lang.String html)

Constructs a `SafeHtmlString` 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 `SafeHtml` interface.

Parameters:
  `html` - the string to be wrapped as a `SafeHtml`

### Method Detail

#### asString

    public java.lang.String asString()

Returns this object's contained HTML as a string.

Based on this class' contract, the returned value will be non-null and a string that is safe to use in an HTML context.

Specified by:
  `asString` in interface `SafeHtml`
Returns:
  the contents as a String

#### equals

    public boolean equals(java.lang.Object obj)

Compares this string to the specified object.

Specified by:
  `equals` in interface `SafeHtml`
Overrides:
  `equals` in class `java.lang.Object`
Parameters:
  `obj` - the object to compare to

#### hashCode

    public int hashCode()

Returns a hash code for this string.

Specified by:
  `hashCode` in interface `SafeHtml`
Overrides:
  `hashCode` in class `java.lang.Object`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`