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.bean.mcp.v20250618;
018
019import static org.apache.juneau.commons.utils.CollectionUtils.*;
020import static org.apache.juneau.commons.utils.Shorts.*;
021
022import java.util.*;
023
024import org.apache.juneau.marshall.*;
025
026/**
027 * Result payload for {@value McpMethods#RESOURCES_READ}.
028 */
029@Marshalled
030public class ReadResourceResult {
031
032   private List<ResourceContents> contents;
033
034   /**
035    * Resource bodies (typically text and/or blob entries).
036    *
037    * @return The contents list, or {@code null} if not set.
038    */
039   public List<ResourceContents> getContents() {
040      return u(contents);
041   }
042
043   /**
044    * Sets resource bodies.
045    *
046    * @param value The new value.  Can be <jk>null</jk> to unset the property.
047    * @return This object (for method chaining).
048    */
049   public ReadResourceResult setContents(List<ResourceContents> value) {
050      contents = value;
051      return this;
052   }
053
054   /**
055    * Sets resource bodies.
056    *
057    * @param value The new value.  Can be <jk>null</jk> to unset the property.
058    * @return This object (for method chaining).
059    */
060   public ReadResourceResult setContents(ResourceContents...value) {
061      contents = list(value);
062      return this;
063   }
064
065   /**
066    * Appends to the resource bodies.
067    *
068    * @param value The values to append.
069    * @return This object (for method chaining).
070    */
071   public ReadResourceResult addContents(ResourceContents...value) {
072      if (contents == null)
073         contents = list();
074      Collections.addAll(contents, value);
075      return this;
076   }
077
078   /**
079    * Appends to the resource bodies.
080    *
081    * @param value The values to append.
082    * @return This object (for method chaining).
083    */
084   public ReadResourceResult addContents(Collection<ResourceContents> value) {
085      if (contents == null)
086         contents = list();
087      contents.addAll(value);
088      return this;
089   }
090}