Class OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml

  • All Implemented Interfaces:
    SafeHtml, java.io.Serializable

    public class OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml
    extends java.lang.Object
    implements SafeHtml
    A string wrapped as an object of type SafeHtml.

    This class is intended only for use in generated code where the code generator guarantees that instances of this type will adhere to the SafeHtml contract (hence the purposely unwieldy class name).

    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml

        public OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml​(java.lang.String html)
        Constructs an instance from a given HTML String.
        Parameters:
        html - an HTML String that is assumed to be safe
    • 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