001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.rest.httppart;
014
015import static org.apache.juneau.httppart.HttpPartType.*;
016
017import java.lang.reflect.*;
018import java.util.regex.*;
019
020import org.apache.http.*;
021import org.apache.juneau.*;
022import org.apache.juneau.httppart.*;
023import org.apache.juneau.rest.*;
024
025/**
026 * Represents a single query parameter on an HTTP request.
027 *
028 * <p>
029 * Typically accessed through the {@link RequestQueryParams} class.
030 *
031 * <p>
032 *    Some important methods on this class are:
033 * </p>
034 * <ul class='javatree'>
035 *    <li class='jc'>{@link RequestQueryParam}
036 *    <ul class='spaced-list'>
037 *       <li>Methods for retrieving simple string values:
038 *       <ul class='javatreec'>
039 *          <li class='jm'>{@link RequestQueryParam#asString() asString()}
040 *          <li class='jm'>{@link RequestQueryParam#get() get()}
041 *          <li class='jm'>{@link RequestQueryParam#isPresent() isPresent()}
042 *          <li class='jm'>{@link RequestQueryParam#orElse(String) orElse(String)}
043 *       </ul>
044 *       <li>Methods for retrieving as other common types:
045 *       <ul class='javatreec'>
046 *          <li class='jm'>{@link RequestQueryParam#asBoolean() asBoolean()}
047 *          <li class='jm'>{@link RequestQueryParam#asBooleanPart() asBooleanPart()}
048 *          <li class='jm'>{@link RequestQueryParam#asCsvArray() asCsvArray()}
049 *          <li class='jm'>{@link RequestQueryParam#asCsvArrayPart() asCsvArrayPart()}
050 *          <li class='jm'>{@link RequestQueryParam#asDate() asDate()}
051 *          <li class='jm'>{@link RequestQueryParam#asDatePart() asDatePart()}
052 *          <li class='jm'>{@link RequestQueryParam#asInteger() asInteger()}
053 *          <li class='jm'>{@link RequestQueryParam#asIntegerPart() asIntegerPart()}
054 *          <li class='jm'>{@link RequestQueryParam#asLong() asLong()}
055 *          <li class='jm'>{@link RequestQueryParam#asLongPart() asLongPart()}
056 *          <li class='jm'>{@link RequestQueryParam#asMatcher(Pattern) asMatcher(Pattern)}
057 *          <li class='jm'>{@link RequestQueryParam#asMatcher(String) asMatcher(String)}
058 *          <li class='jm'>{@link RequestQueryParam#asMatcher(String,int) asMatcher(String,int)}
059 *          <li class='jm'>{@link RequestQueryParam#asStringPart() asStringPart()}
060 *          <li class='jm'>{@link RequestQueryParam#asUriPart() asUriPart()}
061 *       </ul>
062 *       <li>Methods for retrieving as custom types:
063 *       <ul class='javatreec'>
064 *          <li class='jm'>{@link RequestQueryParam#as(Class) as(Class)}
065 *          <li class='jm'>{@link RequestQueryParam#as(ClassMeta) as(ClassMeta)}
066 *          <li class='jm'>{@link RequestQueryParam#as(Type,Type...) as(Type,Type...)}
067 *          <li class='jm'>{@link RequestQueryParam#parser(HttpPartParserSession) parser(HttpPartParserSession)}
068 *          <li class='jm'>{@link RequestQueryParam#schema(HttpPartSchema) schema(HttpPartSchema)}
069 *       </ul>
070 *       <li>Methods for performing assertion checks:
071 *       <ul class='javatreec'>
072 *          <li class='jm'>{@link RequestQueryParam#assertCsvArray() assertCsvArray()}
073 *          <li class='jm'>{@link RequestQueryParam#assertDate() assertDate()}
074 *          <li class='jm'>{@link RequestQueryParam#assertInteger() assertInteger()}
075 *          <li class='jm'>{@link RequestQueryParam#assertLong() assertLong()}
076 *          <li class='jm'>{@link RequestQueryParam#assertString() assertString()}
077 *       </ul>
078 *       <li>Other methods:
079 *       <ul class='javatreec'>
080 *          <li class='jm'>{@link RequestQueryParam#getName() getName()}
081 *          <li class='jm'>{@link RequestQueryParam#getValue() getValue()}
082*     </ul>
083 * </ul>
084 *
085 * <h5 class='section'>See Also:</h5><ul>
086 *    <li class='link'><a class="doclink" href="../../../../../index.html#jrs.HttpParts">HTTP Parts</a>
087 * </ul>
088 */
089public class RequestQueryParam extends RequestHttpPart implements NameValuePair {
090
091   /**
092    * Constructor.
093    *
094    * @param request The request object.
095    * @param name The parameter name.
096    * @param value The parameter value.
097    */
098   public RequestQueryParam(RestRequest request, String name, String value) {
099      super(QUERY, request, name, value);
100   }
101
102   // <FluentSetters>
103
104   @Override /* GENERATED */
105   public RequestQueryParam schema(HttpPartSchema value) {
106      super.schema(value);
107      return this;
108   }
109
110   @Override /* GENERATED */
111   public RequestQueryParam parser(HttpPartParserSession value) {
112      super.parser(value);
113      return this;
114   }
115   // </FluentSetters>
116}