List of usage examples for com.google.common.html.types UncheckedConversions safeHtmlFromStringKnownToSatisfyTypeContract
public static SafeHtml safeHtmlFromStringKnownToSatisfyTypeContract(String html)
From source file:com.google.template.soy.data.SanitizedContent.java
/** * Converts a Soy {@link SanitizedContent} of kind HTML into a {@link SafeHtml}. * * @throws IllegalStateException if this SanitizedContent's content kind is not * {@link ContentKind#HTML}./*from ww w.j a v a 2 s.c o m*/ */ public SafeHtml toSafeHtml() { Preconditions.checkState(getContentKind() == ContentKind.HTML, "toSafeHtml() only valid for SanitizedContent of kind HTML, is: %s", getContentKind()); return UncheckedConversions.safeHtmlFromStringKnownToSatisfyTypeContract(getContent()); }
From source file:com.google.template.soy.data.SanitizedContent.java
/** * Converts a Soy {@link SanitizedContent} of kind HTML into a {@link SafeHtmlProto}. * * @throws IllegalStateException if this SanitizedContent's content kind is not * {@link ContentKind#HTML}./*from w w w . j a v a2s.c o m*/ */ public SafeHtmlProto toSafeHtmlProto() { Preconditions.checkState(getContentKind() == ContentKind.HTML, "toSafeHtmlProto() only valid for SanitizedContent of kind HTML, is: %s", getContentKind()); return SafeHtmls.toProto(UncheckedConversions.safeHtmlFromStringKnownToSatisfyTypeContract(getContent())); }