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 path parameter on an HTTP request. 027 * 028 * <p> 029 * Typically accessed through the {@link RequestPathParams} class. 030 * 031 * <p> 032 * Some important methods on this class are: 033 * </p> 034 * <ul class='javatree'> 035 * <li class='jc'>{@link RequestPathParam} 036 * <ul class='spaced-list'> 037 * <li>Methods for retrieving simple string values: 038 * <ul class='javatreec'> 039 * <li class='jm'>{@link RequestPathParam#asString() asString()} 040 * <li class='jm'>{@link RequestPathParam#get() get()} 041 * <li class='jm'>{@link RequestPathParam#isPresent() isPresent()} 042 * <li class='jm'>{@link RequestPathParam#orElse(String) orElse(String)} 043 * </ul> 044 * <li>Methods for retrieving as other common types: 045 * <ul class='javatreec'> 046 * <li class='jm'>{@link RequestPathParam#asBoolean() asBoolean()} 047 * <li class='jm'>{@link RequestPathParam#asBooleanPart() asBooleanPart()} 048 * <li class='jm'>{@link RequestPathParam#asCsvArray() asCsvArray()} 049 * <li class='jm'>{@link RequestPathParam#asCsvArrayPart() asCsvArrayPart)} 050 * <li class='jm'>{@link RequestPathParam#asDate() asDate()} 051 * <li class='jm'>{@link RequestPathParam#asDatePart() asDatePart()} 052 * <li class='jm'>{@link RequestPathParam#asInteger() asInteger()} 053 * <li class='jm'>{@link RequestPathParam#asIntegerPart() asIntegerPart()} 054 * <li class='jm'>{@link RequestPathParam#asLong() asLong()} 055 * <li class='jm'>{@link RequestPathParam#asLongPart() asLongPart()} 056 * <li class='jm'>{@link RequestPathParam#asMatcher(Pattern) asMatcher(Pattern)} 057 * <li class='jm'>{@link RequestPathParam#asMatcher(String) asMatcher(String)} 058 * <li class='jm'>{@link RequestPathParam#asMatcher(String,int) asMatcher(String,int)} 059 * <li class='jm'>{@link RequestPathParam#asStringPart() asStringPart()} 060 * <li class='jm'>{@link RequestPathParam#asUriPart() asUriPart()} 061 * </ul> 062 * <li>Methods for retrieving as custom types: 063 * <ul class='javatreec'> 064 * <li class='jm'>{@link RequestPathParam#as(Class) as(Class)} 065 * <li class='jm'>{@link RequestPathParam#as(ClassMeta) as(ClassMeta)} 066 * <li class='jm'>{@link RequestPathParam#as(Type,Type...) as(Type,Type...)} 067 * <li class='jm'>{@link RequestPathParam#parser(HttpPartParserSession) parser(HttpPartParserSession)} 068 * <li class='jm'>{@link RequestPathParam#schema(HttpPartSchema) schema(HttpPartSchema)} 069 * </ul> 070 * <li>Methods for performing assertion checks: 071 * <ul class='javatreec'> 072 * <li class='jm'>{@link RequestPathParam#assertCsvArray() assertCsvArray()} 073 * <li class='jm'>{@link RequestPathParam#assertDate() assertDate()} 074 * <li class='jm'>{@link RequestPathParam#assertInteger() assertInteger()} 075 * <li class='jm'>{@link RequestPathParam#assertLong() assertLong()} 076 * <li class='jm'>{@link RequestPathParam#assertString() assertString()} 077 * </ul> 078 * <li>Other methods: 079 * <ul class='javatreec'> 080 * <li class='jm'>{@link RequestPathParam#getName() getName()} 081 * <li class='jm'>{@link RequestPathParam#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 RequestPathParam 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 RequestPathParam(RestRequest request, String name, String value) { 099 super(PATH, request, name, value); 100 this.value = value; 101 } 102 103 // <FluentSetters> 104 105 @Override /* GENERATED */ 106 public RequestPathParam schema(HttpPartSchema value) { 107 super.schema(value); 108 return this; 109 } 110 111 @Override /* GENERATED */ 112 public RequestPathParam parser(HttpPartParserSession value) { 113 super.parser(value); 114 return this; 115 } 116 // </FluentSetters> 117}