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.v20260728; 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 * Optional already-resolved argument values supplied alongside a {@code completion/complete} request. 028 */ 029@Marshalled 030public class CompletionContext { 031 032 private Map<String,String> arguments; 033 034 /** 035 * Already-resolved argument values keyed by argument name. 036 * 037 * @return The arguments map, or {@code null} if not set. 038 */ 039 public Map<String,String> getArguments() { 040 return u(arguments); 041 } 042 043 /** 044 * Sets the resolved argument values. 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 CompletionContext setArguments(Map<String,String> value) { 050 arguments = value; 051 return this; 052 } 053 054 /** 055 * Convenience method to add a single resolved argument value. 056 * 057 * @param name The argument name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key). 058 * @param value The argument value. Can be <jk>null</jk> (stored as <jk>null</jk>). 059 * @return This object (for method chaining). 060 */ 061 public CompletionContext putArgument(String name, String value) { 062 if (arguments == null) 063 arguments = map(); 064 arguments.put(name, value); 065 return this; 066 } 067}