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