Top Description Fields Constructors Methods
com.sun.tools.xjc.reader

public final Class Ring

extends Object
Class Inheritance
Imports
java.lang.reflect.Constructor, java.util.HashMap, .Map, com.sun.tools.xjc.ErrorReceiver, com.sun.tools.xjc.model.Model

Holds all the binding related singleton components in a "ring", and let you access those components, creating them as necessary.

A Ring is local to a thread, and only one instanceof Ring can be active at any given time. Use begin() and end(Ring) to start/end a ring scope. Inside a scope, use get() to obtain the instance.

When a Model is built by the reader, an active Ring scope is assumed.

Components in Ring

Depending on the schema language we are dealing with, different components are in the model. But at least the following components are in the ring.

Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private final Map<Class<?>, Object>
private static final ThreadLocal<Ring>

Constructor Summary

AccessConstructor and Description
private
Ring()

Method Summary

Modifier and TypeMethod and Description
public static <T> void
add(Class<T> clazz, T instance)

public static <T> void
add(T o)

public static Ring
begin()

Starts a new scope.

public static void
end(Ring old)

Ends a scope.

public static <T> T
get(Class<T> key)

public static Ring
get()

An instance is associated with a thread.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

componentsback to summary
private final Map<Class<?>, Object> components
instancesback to summary
private static final ThreadLocal<Ring> instances

Constructor Detail

Ringback to summary
private Ring()

Method Detail

addback to summary
public static <T> void add(Class<T> clazz, T instance)
addback to summary
public static <T> void add(T o)
Annotations
@SuppressWarnings:unchecked
beginback to summary
public static Ring begin()

Starts a new scope.

endback to summary
public static void end(Ring old)

Ends a scope.

getback to summary
public static <T> T get(Class<T> key)
getback to summary
public static Ring get()

An instance is associated with a thread.