1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package com.ohos.hapsigntoolcmd; 17 18 import com.ohos.hapsigntool.api.model.Options; 19 20 import java.util.Map; 21 22 /** 23 * Params. 24 * 25 * @since 2021/12/28 26 */ 27 public class Params { 28 /** 29 * Method names in the command line. 30 */ 31 private String method; 32 33 /** 34 * Hashmap for storing parameters. 35 */ 36 private final Options options = new Options(); 37 38 /** 39 * Constructor of Params. 40 */ Params()41 public Params() { 42 // Empty constructor of Params 43 } 44 getMethod()45 public String getMethod() { 46 return method; 47 } 48 setMethod(String method)49 public void setMethod(String method) { 50 this.method = method; 51 } 52 getOptions()53 public Options getOptions() { 54 return options; 55 } 56 57 @Override toString()58 public String toString() { 59 StringBuilder stringBuilder = new StringBuilder(); 60 stringBuilder.append("Params{ method: "); 61 stringBuilder.append(method); 62 stringBuilder.append(", params: "); 63 for (Map.Entry<String, Object> item : options.entrySet()) { 64 stringBuilder.append('-'); 65 stringBuilder.append(item.getKey()); 66 stringBuilder.append("='"); 67 stringBuilder.append(item.getValue()); 68 stringBuilder.append("';"); 69 } 70 stringBuilder.append('}'); 71 72 return stringBuilder.toString(); 73 } 74 } 75