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 org.apache.juneau.*;
016import org.apache.juneau.http.annotation.*;
017import org.apache.juneau.serializer.*;
018
019/**
020 * Interface used to convert POJOs to simple strings in HTTP headers, query parameters, form-data parameters, and URI
021 * path variables.
022 *
023 * <p>
024 * The following default implementations are provided:
025 * <ul class='javatree'>
026 *    <li class='jc'>{@link org.apache.juneau.oapi.OpenApiSerializer} - Parts encoded based on OpenAPI schema.
027 *    <li class='jc'>{@link org.apache.juneau.uon.UonSerializer} - Parts encoded in UON notation.
028 *    <li class='jc'>{@link org.apache.juneau.httppart.SimplePartSerializer} - Parts encoded in plain text.
029 * </ul>
030 *
031 * <p>
032 * This class is used in the following locations:
033 * <ul class='javatree'>
034 *    <li class='ja'>{@link FormData#serializer()}
035 *    <li class='ja'>{@link Query#serializer()}
036 *    <li class='ja'>{@link Header#serializer()}
037 *    <li class='ja'>{@link Path#serializer()}
038 *    <li class='ja'>{@link Request#serializer()}
039 *    <li class='ja'>{@link Response#serializer()}
040 *    <li class='jc'><c>RestClientBuilder.partSerializer(Class)</c>
041 * </ul>
042 *
043 * <p>
044 * Implementations must include either a public no-args constructor or a public constructor that takes in a single
045 * {@link PropertyStore} object.
046 */
047public interface HttpPartSerializer {
048
049   /**
050    * Represent "no" part part serializer.
051    *
052    * <p>
053    * Used to represent the absence of a part serializer in annotations.
054    */
055   public static interface Null extends HttpPartSerializer {}
056
057   /**
058    * Creates a new serializer session.
059    *
060    * @param args The runtime arguments for the session.
061    * @return A new serializer session.
062    */
063   public HttpPartSerializerSession createPartSession(SerializerSessionArgs args);
064}