54 lines
1.4 KiB
Text
54 lines
1.4 KiB
Text
#
|
|
# AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
#
|
|
msgid ""
|
|
msgstr ""
|
|
"Project-Id-Version: 0\n"
|
|
"POT-Creation-Date: 2013-09-18T00:49:43\n"
|
|
"PO-Revision-Date: 2013-09-18T00:49:43\n"
|
|
"Last-Translator: Automatically generated\n"
|
|
"Language-Team: None\n"
|
|
"MIME-Version: 1.0\n"
|
|
"Content-Type: application/x-publican; charset=UTF-8\n"
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
#. Tag: programlisting
|
|
#, no-c-format
|
|
msgid "\n"
|
|
"interface Callback<T> {\n"
|
|
" T call(boolean flag);\n"
|
|
"}\n"
|
|
"\n"
|
|
"class CallbackInvoker<T> {\n"
|
|
" private final AccessControlContext context;\n"
|
|
" Callback<T> callback;\n"
|
|
"\n"
|
|
" CallbackInvoker(Callback<T> callback) {\n"
|
|
" context = AccessController.getContext();\n"
|
|
" this.callback = callback;\n"
|
|
" }\n"
|
|
"\n"
|
|
" public T invoke() {\n"
|
|
" // Obtain increased privileges.\n"
|
|
" return AccessController.doPrivileged(new PrivilegedAction<T>() {\n"
|
|
" @Override\n"
|
|
" public T run() {\n"
|
|
" // This operation would fail without\n"
|
|
" // additional privileges.\n"
|
|
" final boolean flag = Boolean.getBoolean(\"some.property\");\n"
|
|
"\n"
|
|
" // Restore the original privileges.\n"
|
|
" return AccessController.doPrivileged(\n"
|
|
" new PrivilegedAction<T>() {\n"
|
|
" @Override\n"
|
|
" public T run() {\n"
|
|
" return callback.call(flag);\n"
|
|
" }\n"
|
|
" }, context);\n"
|
|
" }\n"
|
|
" });\n"
|
|
" }\n"
|
|
"}\n"
|
|
""
|
|
msgstr ""
|
|
|