code: public static final RetentionPolicy encode(final Controller.RetentionPolicy policy) {
          // Using default enum type of UNKNOWN(0) to detect if retention policy has been set or not.
          // This is required since proto3 does not have any other way to detect if a field has been set or not.
          if (policy != null && policy.getRetentionType() != Controller.RetentionPolicy.RetentionPolicyType.UNKNOWN) {
              return RetentionPolicy.builder()
                      .retentionType(RetentionPolicy.RetentionType.valueOf(policy.getRetentionType().name()))
                      .retentionParam(policy.getRetentionParam())
                      .build();
          } else {
              return null;
          }
      }
docs: Helper to convert retention policy from RPC call to internal representation.
  
  @param policy The retention policy from RPC interface.
  @return New instance of RetentionPolicy.