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;
018
019import org.apache.juneau.rest.annotation.*;
020import org.apache.juneau.rest.util.*;
021
022/**
023 * Represents a matched {@link Rest}-annotated child on an HTTP request.
024 *
025 * <h5 class='section'>See Also:</h5><ul>
026 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/RestAnnotatedClassBasics">@Rest-Annotated Class Basics</a>
027 * </ul>
028 */
029public class RestChildMatch {
030
031   /**
032    * Creator.
033    *
034    * @param pathMatch The path matching results.
035    * @param childContext The child context.
036    * @return A new {@link RestChildMatch} object.
037    */
038   public static RestChildMatch create(UrlPathMatch pathMatch, RestContext childContext) {
039      return new RestChildMatch(pathMatch, childContext);
040   }
041
042   private UrlPathMatch pathMatch;
043
044   private RestContext childContext;
045
046   /**
047    * Constructor.
048    *
049    * @param pathMatch The path matching results.
050    * @param childContext The child context.
051    */
052   protected RestChildMatch(UrlPathMatch pathMatch, RestContext childContext) {
053      this.pathMatch = pathMatch;
054      this.childContext = childContext;
055   }
056
057   /**
058    * Returns the child context of the REST child match.
059    *
060    * @return The child context of the REST child match.
061    */
062   public RestContext getChildContext() { return childContext; }
063
064   /**
065    * Returns the path matching results of the REST child match.
066    *
067    * @return The path matching results of the REST child match.
068    */
069   public UrlPathMatch getPathMatch() { return pathMatch; }
070}