容器

公開類別 Container

提供容器值存取權的物件。容器物件必須透過 openContainer(String, Container.Callback)ContainerOpener 建立。容器建立後,您可以查詢容器中的鍵/值,這些值可能取決於為容器建立的規則。容器每隔 12 小時會自動重新整理,但您也可以使用 refresh() 手動重新整理。

巢狀類別摘要

Container.Callback 成功載入資源後,系統就會叫用回呼。
Container.FunctionCallMacroHandler 應用程式提供的處理常式,用於計算自訂巨集的值。
Container.FunctionCallTagHandler 應用程式提供的處理常式,用於執行自訂標記。
列舉 Container.RefreshFailure 重新整理失敗的方式。
列舉 Container.RefreshType 容器重新整理的來源。

公用方法摘要

同步 void
close()
布林值
getBoolean(字串 key)
字串
雙精準數
getDouble(字串 key)
已同步 Container.FunctionCallMacroHandler
getFunctionCallMacroHandler(字串 customMacroName)
已同步 Container.FunctionCallTagHandler
getFunctionCallTagHandler(字串 customTagName)
getLong(字串 key)
字串
getString(字串 key)
布林值
同步 void
同步 void
registerFunctionCallMacroHandler(String customMacroNameContainer.FunctionCallMacroHandler customMacroHandler)
同步 void
registerFunctionCallTagHandler(String customTagNameContainer.FunctionCallTagHandler customTagHandler)

公用方法

public sync void close ()

關閉這個容器,容器就不會再重新整理。關閉後不應使用。

public 布林值 getBoolean (字串 key)

傳回代表指定金鑰設定值的布林值。 如果容器沒有該鍵的值,就會傳回 false。

public 字串 getContainerId ()

傳回容器 ID。

public Double getDouble (字串 key)

傳回代表指定金鑰設定值的雙精度浮點值。 如果容器沒有這組鍵的值,就會傳回 0。

public 已同步的 Container.FunctionCallMacroHandler getFunctionCallMacroHandler (String customMacroName)

傳回已為指定函式呼叫巨集所註冊的巨集處理常式。

public 已同步的 Container.FunctionCallTagHandler getFunctionCallTagHandler (String customTagName)

傳回已為指定函式呼叫標記註冊的標記處理常式。

public long getLastRefreshTime ()

傳回這個容器從網路重新整理的上次時間 (以世界標準時間為準,自世界標準時間 1970 年 1 月 1 日午夜起)。

public 長 getLong (字串 key)

傳回代表指定金鑰設定值的 Long。 如果容器沒有這組鍵的值,就會傳回 0。

public 字串 getString (字串 key)

傳回代表指定金鑰設定值的字串。如果容器沒有這組鍵的值,就會傳回空字串。

public 布林值 isDefault ()

傳回這是預設容器,或是從伺服器重新整理的容器。

public sync void refresh ()

從網路重新整理這個容器的要求。 這項呼叫為非同步,因此會在另一個執行緒中執行重新整理作業。

呼叫 Refresh() 後,您需要等待至少 15 分鐘才能再次嘗試呼叫此方法,否則後續呼叫可能會因此無法執行任何操作。

public sync void registerFunctionCallMacroHandler (String customMacroNameContainer.FunctionCallMacroHandler customMacroHandler)

註冊指定的巨集處理常式以處理指定的函式呼叫巨集。

參數
customMacroName 要註冊的巨集名稱
customMacroHandler 處理常式即可如果為空值,系統會取消註冊該巨集的任何現有處理常式。

public 已同步 void registerFunctionCallTagHandler (String customTagNameContainer.FunctionCallTagHandler customTagHandler)

註冊標記處理常式以處理指定的函式呼叫代碼。

參數
customTagName 要註冊的代碼名稱
customTagHandler 處理常式即可如果為空值,系統會取消註冊該標記的任何現有處理常式。