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.rest.client.remote;
014
015import static org.apache.juneau.internal.ClassUtils.*;
016
017import org.apache.juneau.http.annotation.*;
018import org.apache.juneau.httppart.*;
019import org.apache.juneau.httppart.bean.*;
020
021/**
022 * Represents the metadata about an {@link Response}-annotated return type on a method on a REST proxy class.
023 *
024 * <ul class='seealso'>
025 *    <li class='link'>{@doc juneau-rest-client.RestProxies}
026 * </ul>
027 */
028public final class RemoteMethodBeanReturn {
029
030   private final ResponseBeanMeta meta;
031   private final HttpPartParser parser;
032
033   RemoteMethodBeanReturn(Class<? extends HttpPartParser> parser, ResponseBeanMeta meta) {
034      this.parser = castOrCreate(HttpPartParser.class, parser);
035      this.meta = meta;
036   }
037
038   /**
039    * Returns the parser to use for parsing parts on the response bean.
040    *
041    * @return The parser to use for parsing parts on the response bean, or <jk>null</jk> if not defined.
042    */
043   public HttpPartParser getParser() {
044      return parser;
045   }
046
047   /**
048    * Returns metadata on the response bean.
049    *
050    * @return Metadata about the bean.
051    */
052   public ResponseBeanMeta getMeta() {
053      return meta;
054   }
055}