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.httppart;
014
015import java.lang.reflect.*;
016
017import org.apache.juneau.*;
018import org.apache.juneau.parser.*;
019
020/**
021 * Interface used to convert HTTP headers, query parameters, form-data parameters, and URI path variables to POJOs
022 *
023 * <p>
024 * The following default implementations are provided:
025 * <ul class='doctree'>
026 *    <li class='jc'>{@link org.apache.juneau.oapi.OpenApiParser} - Parts encoded in based on OpenAPI schema.
027 *    <li class='jc'>{@link org.apache.juneau.uon.UonParser} - Parts encoded in UON notation.
028 *    <li class='jc'>{@link org.apache.juneau.httppart.SimplePartParser} - Parts encoded in plain text.
029 * </ul>
030 *
031 * <p>
032 * Implementations must include either a public no-args constructor or a public constructor that takes in a single
033 * {@link PropertyStore} object.
034 */
035public interface HttpPartParser {
036
037   /**
038    * Represent "no" part parser.
039    *
040    * <p>
041    * Used to represent the absence of a part parser in annotations.
042    */
043   public static interface Null extends HttpPartParser {}
044
045   /**
046    * Creates a new parser session.
047    *
048    * @param args The runtime arguments for the session.
049    * @return A new parser session.
050    */
051   public HttpPartParserSession createPartSession(ParserSessionArgs args);
052
053   /**
054    * Returns metadata about the specified class.
055    *
056    * @param <T> The class type.
057    * @param c The class type.
058    * @return Metadata about the specified class.
059    */
060   public <T> ClassMeta<T> getClassMeta(Class<T> c);
061
062   /**
063    * Returns metadata about the specified class.
064    *
065    * @param <T> The class type.
066    * @param t The class type.
067    * @param args The class type args.
068    * @return Metadata about the specified class.
069    */
070   public <T> ClassMeta<T> getClassMeta(Type t, Type...args);
071}