goog.string.Const
Provided By | |
---|---|
All Implemented Interfaces | |
All Known Aliases |
Wrapper for compile-time-constant strings.
Const is a wrapper for strings that can only be created from program
constants (i.e., string literals). This property relies on a custom Closure
compiler check that goog.string.Const.from
is only invoked on
compile-time-constant expressions.
Const is useful in APIs whose correct and secure use requires that certain arguments are not attacker controlled: Compile-time constants are inherently under the control of the application and not under control of external attackers, and hence are safe to use in such contexts.
Instances of this type must be created via its factory method
goog.string.Const.from
and not by invoking its constructor. The
constructor intentionally takes no parameters and the type is immutable;
hence only a default instance corresponding to the empty string can be
obtained via constructor invocation. Use goog.string.Const.EMPTY
instead of using this constructor to get an empty Const string.
new Const( opt_token, opt_content )
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
See Also |