Class DefaultVarExploder

  • All Implemented Interfaces:
    VarExploder

    public class DefaultVarExploder
    extends Object
    implements VarExploder

    The DefaultVarExploder is a VarExploder implementation that takes in a Java object and extracts the properties for use in a URI Template. Given the following URI expression:

     /mapper{?address*}
     

    And this Java object for an address:

     Address address = new Address();
     address.setState("CA");
     address.setCity("Newport Beach");
     String result = UriTemplate.fromTemplate("/mapper{?address*}").set("address", address).expand();
     

    The expanded URI will be:

     /mapper?city=Newport%20Beach&state=CA
     

    The DefaultVarExploder breaks down the object properties as follows:

    • All properties that contain a non-null return value will be included
    • Getters or fields annotated with UriTransient will NOT included in the list
    • By default, the property name is used as the label in the URI. This can be overridden by placing the VarName annotation on the field or getter method and specifying a name.
    • Field level annotation take priority of getter annotations
    Since:
    1.0
    Version:
    $Revision: 1.1 $
    Author:
    Ryan J. McDonough
    See Also:
    VarName, UriTransient, VarExploder