支援設定數字字段,例如 byte、short、int、long、float 和 double 字段。這包括未裝箱和裝箱版本(例如 int 與 Integer)。如果在設定參數以符合所需類型時出現問題,則會引發
嵌套類 |
---|
class | OptionSetter.OptionFieldsForName 具有給定名稱的選項欄位清單的容器。 |
公共構造函數 |
---|
OptionSetter (Object... optionSources) 建構一個新的 OptionParser 用於設定「optionSources」的 @Option 欄位。 |
OptionSetter ( optionSources) OptionSetter ( optionSources) 建構一個新的 OptionParser 用於設定「optionSources」的 @Option 欄位。 |
常數
NAMESPACE_SEPARATOR
public static final char NAMESPACE_SEPARATOR
常數值:58 (0x0000003a)
公共構造函數
選項設定器
public OptionSetter (Object... optionSources)
建構一個新的 OptionParser 用於設定「optionSources」的 @Option 欄位。
選項設定器
public OptionSetter ( optionSources)
建構一個新的 OptionParser 用於設定「optionSources」的 @Option 欄位。
公共方法
取得欄位值
public static Object getFieldValue (Field field,
Object optionObject)
傳回給定ERROR(/Field)
的值,處理任何異常。
取得金鑰庫
public IKeyStoreClient getKeyStore ()
getOptionFieldsForClass
public static getOptionFieldsForClass (Class<?> optionClass)
取得給定類別的所有Option
欄位(聲明的和繼承的)的清單。
參數 |
---|
optionClass | Class : 要搜尋的Class |
取得選項類型
public String getTypeForOption (String name)
傳回一個字串,描述具有給定名稱的欄位的類型。
投擲 |
---|
ConfigurationException | 如果找不到字段 |
isBooleanOption
public boolean isBooleanOption (String name)
是地圖選項
public boolean isMapOption (String name)
設定密鑰庫
public void setKeyStore (IKeyStoreClient keyStore)
參數 |
---|
keyStore | IKeyStoreClient |
設定選項值
public setOptionValue (String optionName,
String valueText)
設定非地圖選項的值。
參數 |
---|
optionName | String : 要設定的選項的名稱 |
valueText | String :值 |
投擲 |
---|
ConfigurationException | 如果找不到選項或 valueText 類型錯誤 |
設定選項值
public setOptionValue (String optionName,
String keyText,
String valueText)
設定選項的值。
參數 |
---|
optionName | String : 要設定的選項的名稱 |
keyText | String :地圖選項的鍵,或 null。 |
valueText | String :值 |
投擲 |
---|
ConfigurationException | 如果找不到選項或 valueText 類型錯誤 |
受保護的方法
取得UnsetMandatoryOptions
protected getUnsetMandatoryOptions ()
傳回所有標記為mandatory
但未設定的Option
的名稱。
投擲 |
---|
ConfigurationException | 如果要檢查的欄位無法存取 |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2023-12-01 (世界標準時間)。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]