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