Class UrlEncodingSerializer.Builder

Enclosing class:
UrlEncodingSerializer

Builder class.
  • Constructor Details

  • Method Details

    • build

      Description copied from class: Context.Builder
      Build the object.
      Overrides:
      build in class UonSerializer.Builder<UrlEncodingSerializer.Builder>
      Returns:
      The built object.
    • copy

      Description copied from class: Context.Builder
      Copy creator.
      Specified by:
      copy in class UonSerializer.Builder<UrlEncodingSerializer.Builder>
      Returns:
      A new mutable copy of this builder.
    • expandedParams

      Serialize bean property collections/arrays as separate key/value pairs.

      By default, serializing the array [1,2,3] results in ?key=$a(1,2,3).
      When enabled, serializing the same array results in ?key=1&key=2&key=3.

      This option only applies to beans.

      Notes:
      • If parsing multi-part parameters, it's highly recommended to use Collections or Lists as bean property types instead of arrays since arrays have to be recreated from scratch every time a value is added to it.
      Example:

      // A sample bean. public class A { public String[] f1 = {"a","b"}; public List<String> f2 = Arrays.asList(new String[]{"c","d"}); } // Normal serializer. WriterSerializer serializer1 = UrlEncodingSerializer.DEFAULT; // Expanded-params serializer. WriterSerializer serializer2 = UrlEncodingSerializer.create().expandedParams().build(); // Produces "f1=(a,b)&f2=(c,d)" String out1 = serializer1.write(new A()); // Produces "f1=a&f1=b&f2=c&f2=d" String out2 = serializer2.write(new A());

      Returns:
      This object.
    • expandedParams

      Same as expandedParams() but allows you to explicitly specify the value.
      Parameters:
      value - The value for this setting.
      Returns:
      This object.
    • hashKey

      public HashKey hashKey()
      Description copied from class: Context.Builder
      Returns the hashkey of this builder.

      Used to return previously instantiated context beans that have matching hashkeys. The HashKey object is suitable for use as a hashmap key of a map of context beans. A context bean is considered equivalent if the HashKey.equals(Object) method is the same.

      Overrides:
      hashKey in class UonSerializer.Builder<UrlEncodingSerializer.Builder>
      Returns:
      The hashkey of this builder.