Example #1
0
 /**
  * Serializes a SafeStyle into its opaque protocol message representation.
  *
  * <p>Protocol message forms of this type are intended to be opaque. The fields of the returned
  * protocol message should be considered encapsulated and are not intended for direct inspection
  * or manipulation. Protocol messages can be converted back into a SafeStyle using {@link
  * #fromProto(SafeStyleProto)}.
  */
 public static SafeStyleProto toProto(SafeStyle style) {
   return SafeStyleProto.newBuilder()
       .setPrivateDoNotAccessOrElseSafeStyleWrappedValue(style.getSafeStyleString())
       .build();
 }
Example #2
0
 /**
  * Deserializes a SafeStyleProto into a SafeStyle instance.
  *
  * <p>Protocol-message forms are intended to be opaque. The fields of the protocol message should
  * be considered encapsulated and are not intended for direct inspection or manipulation. Protocol
  * message forms of this type should be produced by {@link #toProto(SafeStyle)} or its equivalent
  * in other implementation languages.
  *
  * <p><b>Important:</b> It is unsafe to invoke this method on a protocol message that has been
  * received from an entity outside the application's trust domain. Data coming from the browser is
  * outside the application's trust domain.
  */
 public static SafeStyle fromProto(SafeStyleProto proto) {
   return create(proto.getPrivateDoNotAccessOrElseSafeStyleWrappedValue());
 }