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.server.httppart;
018
019import org.apache.juneau.commons.httppart.*;
020import org.apache.juneau.marshall.httppart.*;
021
022/**
023 * Represents the information needed to serialize a response part such as a response header or content.
024 *
025 * <h5 class='section'>See Also:</h5><ul>
026 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/RestServerHttpParts">HTTP parts in REST servers</a>
027 * </ul>
028 */
029public class ResponsePartMeta {
030
031   /**
032    * Represents a non-existent meta.
033    */
034   public static final ResponsePartMeta NULL = new ResponsePartMeta(null, null, null);
035
036   private final HttpPartType partType;
037   private final HttpPartSchema schema;
038   private final HttpPartSerializer serializer;
039
040   /**
041    * Constructor.
042    *
043    * @param partType The part type.  Can be <jk>null</jk> (see {@link #NULL}).
044    * @param schema The part schema.  Can be <jk>null</jk> (see {@link #NULL}).
045    * @param serializer The serializer to use to serialize the part.  Can be <jk>null</jk> (see {@link #NULL}).
046    */
047   public ResponsePartMeta(HttpPartType partType, HttpPartSchema schema, HttpPartSerializer serializer) {
048      this.partType = partType;
049      this.schema = schema;
050      this.serializer = serializer;
051   }
052
053   /**
054    * Returns the part type.
055    *
056    * @return The part type.
057    */
058   public HttpPartType getPartType() { return partType; }
059
060   /**
061    * Returns the part schema.
062    *
063    * @return The part schema.
064    */
065   public HttpPartSchema getSchema() { return schema; }
066
067   /**
068    * Returns the part serializer.
069    *
070    * @return The part serializer.
071    */
072   public HttpPartSerializer getSerializer() { return serializer; }
073}