Class PrimitiveValueOfExtractor

  • All Implemented Interfaces:
    MultivaluedParameterExtractor<java.lang.Object>

    final class PrimitiveValueOfExtractor
    extends java.lang.Object
    implements MultivaluedParameterExtractor<java.lang.Object>
    Extract primitive parameter value from the multivalued parameter map using one of the valueOf(String) methods on the primitive Java type wrapper classes.
    • Constructor Summary

      Constructors 
      Constructor Description
      PrimitiveValueOfExtractor​(java.lang.reflect.Method valueOf, java.lang.String parameter, java.lang.String defaultStringValue, java.lang.Object defaultPrimitiveTypeValue)
      Create new primitive parameter value extractor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object extract​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> parameters)
      Extract the map entry identified by a name (and using the configured default value) from the supplied multivalued map.
      java.lang.String getDefaultValueString()
      Default entry value (string) that will be used in case the entry is not present in the supplied multivalued map.
      java.lang.String getName()
      Name of the parameter (map key) to be extracted from the supplied multivalued map.
      private java.lang.Object getValue​(java.lang.String v)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • valueOf

        private final java.lang.reflect.Method valueOf
      • parameter

        private final java.lang.String parameter
      • defaultStringValue

        private final java.lang.String defaultStringValue
      • defaultValue

        private final java.lang.Object defaultValue
      • defaultPrimitiveTypeValue

        private final java.lang.Object defaultPrimitiveTypeValue
    • Constructor Detail

      • PrimitiveValueOfExtractor

        public PrimitiveValueOfExtractor​(java.lang.reflect.Method valueOf,
                                         java.lang.String parameter,
                                         java.lang.String defaultStringValue,
                                         java.lang.Object defaultPrimitiveTypeValue)
        Create new primitive parameter value extractor.
        Parameters:
        valueOf - valueOf() method handler.
        parameter - string parameter value.
        defaultStringValue - default string value.
        defaultPrimitiveTypeValue - default primitive type value.
    • Method Detail

      • getDefaultValueString

        public java.lang.String getDefaultValueString()
        Description copied from interface: MultivaluedParameterExtractor
        Default entry value (string) that will be used in case the entry is not present in the supplied multivalued map.
        Specified by:
        getDefaultValueString in interface MultivaluedParameterExtractor<java.lang.Object>
        Returns:
        default (back-up) map entry value.
      • getValue

        private java.lang.Object getValue​(java.lang.String v)
      • extract

        public java.lang.Object extract​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> parameters)
        Description copied from interface: MultivaluedParameterExtractor
        Extract the map entry identified by a name (and using the configured default value) from the supplied multivalued map.
        Specified by:
        extract in interface MultivaluedParameterExtractor<java.lang.Object>
        Parameters:
        parameters - multivalued parameter map.
        Returns:
        custom Java type instance representing the extracted multivalued map entry.