< prev index next >
src/java.desktop/share/classes/sun/awt/AppContext.java
Print this page
@@ -69,30 +69,31 @@
* of "default" to be ThreadGroup-specific. Application services
* lookup their singleton in the AppContext.<p>
*
* For example, here we have a Foo service, with its pre-AppContext
* code:<p>
- * <code><pre>
+ * <pre>{@code
* public class Foo {
* private static Foo defaultFoo = new Foo();
*
* public static Foo getDefaultFoo() {
* return defaultFoo;
* }
*
* ... Foo service methods
- * }</pre></code><p>
+ * }
+ * }</pre><p>
*
* The problem with the above is that the Foo service is global in scope,
* so that applets and other untrusted code can execute methods on the
* single, shared Foo instance. The Foo service therefore either needs
* to block its use by untrusted code using a SecurityManager test, or
* restrict its capabilities so that it doesn't matter if untrusted code
* executes it.<p>
*
* Here's the Foo class written to use the AppContext:<p>
- * <code><pre>
+ * <pre>{@code
* public class Foo {
* public static Foo getDefaultFoo() {
* Foo foo = (Foo)AppContext.getAppContext().get(Foo.class);
* if (foo == null) {
* foo = new Foo();
@@ -100,11 +101,12 @@
* }
* return foo;
* }
*
* ... Foo service methods
- * }</pre></code><p>
+ * }
+ * }</pre><p>
*
* Since a separate AppContext can exist for each ThreadGroup, trusted
* and untrusted code have access to different Foo instances. This allows
* untrusted code access to "system-wide" services -- the service remains
* within the AppContext "sandbox". For example, say a malicious applet
@@ -157,11 +159,11 @@
*/
private static final Map<ThreadGroup, AppContext> threadGroup2appContext =
Collections.synchronizedMap(new IdentityHashMap<ThreadGroup, AppContext>());
/**
- * Returns a set containing all <code>AppContext</code>s.
+ * Returns a set containing all {@code AppContext}s.
*/
public static Set<AppContext> getAppContexts() {
synchronized (threadGroup2appContext) {
return new HashSet<AppContext>(threadGroup2appContext.values());
}
@@ -185,12 +187,12 @@
private final Map<Object, Object> table = new HashMap<>();
private final ThreadGroup threadGroup;
/**
- * If any <code>PropertyChangeListeners</code> have been registered,
- * the <code>changeSupport</code> field describes them.
+ * If any {@code PropertyChangeListeners} have been registered,
+ * the {@code changeSupport} field describes them.
*
* @see #addPropertyChangeListener
* @see #removePropertyChangeListener
* @see PropertyChangeSupport#firePropertyChange
*/
@@ -628,11 +630,11 @@
/**
* Returns the value to which the specified key is mapped in this context.
*
* @param key a key in the AppContext.
* @return the value to which the key is mapped in this AppContext;
- * <code>null</code> if the key is not mapped to any value.
+ * {@code null} if the key is not mapped to any value.
* @see #put(Object, Object)
* @since 1.2
*/
public Object get(Object key) {
/*
@@ -665,23 +667,23 @@
return value;
}
}
/**
- * Maps the specified <code>key</code> to the specified
- * <code>value</code> in this AppContext. Neither the key nor the
- * value can be <code>null</code>.
+ * Maps the specified {@code key} to the specified
+ * {@code value} in this AppContext. Neither the key nor the
+ * value can be {@code null}.
* <p>
- * The value can be retrieved by calling the <code>get</code> method
+ * The value can be retrieved by calling the {@code get} method
* with a key that is equal to the original key.
*
* @param key the AppContext key.
* @param value the value.
* @return the previous value of the specified key in this
- * AppContext, or <code>null</code> if it did not have one.
+ * AppContext, or {@code null} if it did not have one.
* @exception NullPointerException if the key or value is
- * <code>null</code>.
+ * {@code null}.
* @see #get(Object)
* @since 1.2
*/
public Object put(Object key, Object value) {
synchronized (table) {
@@ -697,11 +699,11 @@
* AppContext. This method does nothing if the key is not in the
* AppContext.
*
* @param key the key that needs to be removed.
* @return the value to which the key had been mapped in this AppContext,
- * or <code>null</code> if the key did not have a mapping.
+ * or {@code null} if the key did not have a mapping.
* @since 1.2
*/
public Object remove(Object key) {
synchronized (table) {
MostRecentKeyValue recent = mostRecentKeyValue;
@@ -741,11 +743,11 @@
/**
* Returns an array of all the property change listeners
* registered on this component.
*
- * @return all of this component's <code>PropertyChangeListener</code>s
+ * @return all of this component's {@code PropertyChangeListener}s
* or an empty array if no property change
* listeners are currently registered
*
* @see #addPropertyChangeListener
* @see #removePropertyChangeListener
@@ -820,11 +822,11 @@
/**
* Returns an array of all the listeners which have been associated
* with the named property.
*
- * @return all of the <code>PropertyChangeListeners</code> associated with
+ * @return all of the {@code PropertyChangeListeners} associated with
* the named property or an empty array if no listeners have
* been added
*
* @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
* @see #removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
< prev index next >