Class PatchBuilder


  • public class PatchBuilder
    extends Object
    A builder of a map to be used as the request body of PATCH operations. The following code:
     new PatchBuilder()
       .set("labels.starred", true)
       .set("labels.hidden", false)
       .getMap();
     
    returns a Map, which will be serialized to the following JSON:
     {
       "labels": {
         "starred": true,
         "hidden": false
        }
     }
     
    Author:
    Gabriel Axel
    See Also:
    AbstractGoogleApiOperations.patch(String, Object, Class)
    • Constructor Detail

      • PatchBuilder

        public PatchBuilder()
    • Method Detail

      • set

        public PatchBuilder set​(String path,
                                Object value)
        Adds a property and a value to be set in the PATCH request
        Parameters:
        path - the path representing the property, with "." representing nested properties
        value - the value to be set for the property
        Returns:
        the PatchBuilder instance
      • set

        public PatchBuilder set​(String path,
                                Enum<?> value)
        Adds a property and a value to be set in the PATCH request
        Parameters:
        path - the path representing the property, with "." representing nested properties
        value - the value to be set for the property
        Returns:
        the PatchBuilder instance
      • delete

        public PatchBuilder delete​(String path)
        Defines a property to be deleted by setting its value to null. Equivalent to invoking set(String, Object) with null value
        Parameters:
        path - the path representing the property, with "." representing nested properties
        Returns:
        the PatchBuilder instance
      • getMap

        public Map<String,​Object> getMap()
        Returns the map created so far
        Returns:
        Map with the set properties