Class StringCollectionExtractor

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String defaultValue  
      private java.lang.String parameter  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected StringCollectionExtractor​(java.lang.String parameterName, java.lang.String defaultValue)
      Create new string collection parameter extractor.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<java.lang.String> 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.
      static StringCollectionExtractor getInstance​(java.lang.Class<?> collectionType, java.lang.String parameterName, java.lang.String defaultValue)
      Get string collection extractor instance supporting the given collection class type for the parameter specified.
      java.lang.String getName()
      Name of the parameter (map key) to be extracted from the supplied multivalued map.
      protected abstract java.util.Collection<java.lang.String> newCollection()
      Get a new string collection instance that will be used to store the extracted parameters.
      • Methods inherited from class java.lang.Object

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

      • parameter

        private final java.lang.String parameter
      • defaultValue

        private final java.lang.String defaultValue
    • Constructor Detail

      • StringCollectionExtractor

        protected StringCollectionExtractor​(java.lang.String parameterName,
                                            java.lang.String defaultValue)
        Create new string collection parameter extractor.
        Parameters:
        parameterName - parameter name.
        defaultValue - default parameter value.
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: MultivaluedParameterExtractor
        Name of the parameter (map key) to be extracted from the supplied multivalued map.
        Specified by:
        getName in interface MultivaluedParameterExtractor<java.util.Collection<java.lang.String>>
        Returns:
        name of the extracted parameter.
      • 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.util.Collection<java.lang.String>>
        Returns:
        default (back-up) map entry value.
      • extract

        public java.util.Collection<java.lang.String> 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.util.Collection<java.lang.String>>
        Parameters:
        parameters - multivalued parameter map.
        Returns:
        custom Java type instance representing the extracted multivalued map entry.
      • newCollection

        protected abstract java.util.Collection<java.lang.String> newCollection()
        Get a new string collection instance that will be used to store the extracted parameters. The method is overridden by concrete implementations to return an instance of a proper collection sub-type.
        Returns:
        instance of a proper collection sub-type
      • getInstance

        public static StringCollectionExtractor getInstance​(java.lang.Class<?> collectionType,
                                                            java.lang.String parameterName,
                                                            java.lang.String defaultValue)
        Get string collection extractor instance supporting the given collection class type for the parameter specified.
        Parameters:
        collectionType - collection type to be supported by the extractor.
        parameterName - extracted parameter name.
        defaultValue - default parameter value.
        Returns:
        string collection extractor instance supporting the given collection class type.