Class Optionalish


  • public class Optionalish
    extends Object
    A wrapper for properties of Optional-like classes. This can be com.google.common.base.Optional, or any of Optional, OptionalDouble, OptionalInt, OptionalLong in java.util.
    Author:
    emcmanus@google.com (Éamonn McManus)
    • Method Detail

      • getRawType

        public String getRawType()
        Returns a string representing the raw type of this Optional. This will typically be just "Optional", but it might be "OptionalInt" or "java.util.Optional" for example.
      • getEmpty

        public String getEmpty()
        Returns a string representing the method call to obtain the empty version of this Optional. This will be something like "Optional.empty()" or possibly "java.util.Optional.empty()". It does not have a final semicolon.

        This method is public so that it can be referenced as p.optional.empty from templates.