Container

  • Container objects provide access to container values and must be created viaTagManagerloadContainer calls.

  • Container objects can be queried for key values that may depend on established rules.

  • The Container class includes nested interfaces for custom macro and tag callbacks.

  • Public methods allow retrieving boolean, string, double, and long configuration values, as well as the container ID and last refresh time.

  • You can register and unregister callbacks for function call macros and tags.

public classContainer extendsObject

An object that provides access to container values. Container objects must be created via one of theTagManagerloadContainer calls. Once a container is created, it can be queried for key values which may depend on rules established for the container.

Nested Class Summary

interface Container.FunctionCallMacroCallbackCallback that is provided by the application to calculate the value of a custom macro. 
interface Container.FunctionCallTagCallbackCallback that is provided by the application to execute a custom tag. 

Public Method Summary

boolean
getBoolean(String key)
Returns a boolean representing the configuration value for the given key.
String
getContainerId()
Returns the container id.
double
getDouble(String key)
Returns a double representing the configuration value for the given key.
long
getLastRefreshTime()
Returns the last time (in milliseconds since midnight, January 1, 1970 UTC) that this container was refreshed from the network.
long
getLong(String key)
Returns a long representing the configuration value for the given key.
String
getString(String key)
Returns a string representing the configuration value for the given key.
boolean
isDefault()
Returns whether this is a default container, or one refreshed from the server.
void
registerFunctionCallMacroCallback(String customMacroName, Container.FunctionCallMacroCallback customMacroCallback)
Registers the given macro callback to handle a given function call macro.
void
registerFunctionCallTagCallback(String customTagName, Container.FunctionCallTagCallback customTagCallback)
Registers the tag callback to handle a given function call tag.
void
unregisterFunctionCallMacroCallback(String customMacroName)
Unregisters any macro callback for the given macro.
void
unregisterFunctionCallTagCallback(String customTagName)
Unregisters any tag callback for the given tag.

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()

Public Methods

public booleangetBoolean(String key)

Returns a boolean representing the configuration value for the given key. If the container has no value for this key, false will be returned.

publicStringgetContainerId()

Returns the container id.

public doublegetDouble(String key)

Returns a double representing the configuration value for the given key. If the container has no value for this key, 0 will be returned.

public longgetLastRefreshTime()

Returns the last time (in milliseconds since midnight, January 1, 1970 UTC) that this container was refreshed from the network.

public longgetLong(String key)

Returns a long representing the configuration value for the given key. If the container has no value for this key, 0 will be returned.

publicStringgetString(String key)

Returns a string representing the configuration value for the given key. If the container has no value for this key, an empty string will be returned.

public booleanisDefault()

Returns whether this is a default container, or one refreshed from the server.

public voidregisterFunctionCallMacroCallback(String customMacroName, Container.FunctionCallMacroCallback customMacroCallback)

Registers the given macro callback to handle a given function call macro.

Parameters
customMacroNamethe name of the macro which is being registered
customMacroCallbackthe callback to register

public voidregisterFunctionCallTagCallback(String customTagName, Container.FunctionCallTagCallback customTagCallback)

Registers the tag callback to handle a given function call tag.

Parameters
customTagNamethe name of the tag which is being registered
customTagCallbackthe callback to register

public voidunregisterFunctionCallMacroCallback(String customMacroName)

Unregisters any macro callback for the given macro.

Parameters
customMacroNamethe name of the macro which is being unregistered

public voidunregisterFunctionCallTagCallback(String customTagName)

Unregisters any tag callback for the given tag.

Parameters
customTagNamethe name of the tag which is being unregistered

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.