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