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.parser;
018
019import org.apache.juneau.*;
020
021/**
022 * Represents a parser and media type that matches an HTTP <c>Content-Type</c> header value.
023 *
024 * <h5 class='section'>See Also:</h5><ul>
025 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/SerializersAndParsers">Serializers and Parsers</a>
026 * </ul>
027 */
028public class ParserMatch {
029
030   private final MediaType mediaType;
031   private final Parser parser;
032
033   /**
034    * Constructor.
035    *
036    * @param mediaType The media type of the match.
037    * @param parser The parser that matched.
038    */
039   public ParserMatch(MediaType mediaType, Parser parser) {
040      this.mediaType = mediaType;
041      this.parser = parser;
042   }
043
044   /**
045    * Returns the media type of the parser that matched the HTTP <c>Content-Type</c> header value.
046    *
047    * @return The media type of the match.
048    */
049   public MediaType getMediaType() {
050      return mediaType;
051   }
052
053   /**
054    * Returns the parser that matched the HTTP <c>Content-Type</c> header value.
055    *
056    * @return The parser of the match.
057    */
058   public Parser getParser() {
059      return parser;
060   }
061}