/** * Creates a {@link TrustedResourceUrl} wrapping the given {@code string}. No validation is * performed. * * <p>If possible please use the production API in * {@link com.google.common.html.types.TrustedResourceUrls} * instead. */ public static TrustedResourceUrl newTrustedResourceUrlForTest(String string) { return UncheckedConversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract(string); }
/** * Converts a Soy {@link SanitizedContent} of kind TRUSTED_RESOURCE_URI into a {@link * TrustedResourceUrlProto}. * * @throws IllegalStateException if this SanitizedContent's content kind is not {@link * ContentKind#TRUSTED_RESOURCE_URI}. */ public TrustedResourceUrlProto toTrustedResourceUrlProto() { Preconditions.checkState( getContentKind() == ContentKind.TRUSTED_RESOURCE_URI, "toTrustedResourceUrlProto() only valid for SanitizedContent of kind TRUSTED_RESOURCE_URI, " + "is: %s", getContentKind()); return TrustedResourceUrls.toProto( UncheckedConversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract(getContent())); }
/** * Converts a Soy {@link SanitizedContent} of kind TRUSTED_RESOURCE_URI into a {@link * TrustedResourceUrlProto}. * * @throws IllegalStateException if this SanitizedContent's content kind is not {@link * ContentKind#TRUSTED_RESOURCE_URI}. */ public TrustedResourceUrlProto toTrustedResourceUrlProto() { Preconditions.checkState( getContentKind() == ContentKind.TRUSTED_RESOURCE_URI, "toTrustedResourceUrlProto() only valid for SanitizedContent of kind TRUSTED_RESOURCE_URI, " + "is: %s", getContentKind()); return TrustedResourceUrls.toProto( UncheckedConversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract(getContent())); }