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.parser;
014
015import org.apache.juneau.http.*;
016
017/**
018 * Represents a parser and media type that matches an HTTP <code>Content-Type</code> header value.
019 */
020public final class ParserMatch {
021
022   private final MediaType mediaType;
023   private final Parser parser;
024
025   /**
026    * Constructor.
027    *
028    * @param mediaType The media type of the match.
029    * @param parser The parser that matched.
030    */
031   public ParserMatch(MediaType mediaType, Parser parser) {
032      this.mediaType = mediaType;
033      this.parser = parser;
034   }
035
036   /**
037    * Returns the media type of the parser that matched the HTTP <code>Content-Type</code> header value.
038    *
039    * @return The media type of the match.
040    */
041   public MediaType getMediaType() {
042      return mediaType;
043   }
044
045   /**
046    * Returns the parser that matched the HTTP <code>Content-Type</code> header value.
047    *
048    * @return The parser of the match.
049    */
050   public Parser getParser() {
051      return parser;
052   }
053}