|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.wireformats.AltRegistry
public class AltRegistry
The AltRegistry class maintains a registry of supported alternate representation formats along with the configuration of input and output handlers that will be used to process wire format content using the representations.
The registry supports a delegation model where lookup failures can be delegated to a different registry to support tiered lookup models. It also has a locking model to avoid changes occurring after initialization has been completed.
The class provides a locking model where the contents of the registry can be
made immutable using the lock()
method. After this call, no
subsequent changes may be made to the registry and it is thread safe to
share across multiple threads.
Constructor Summary | |
---|---|
AltRegistry()
Constructs a new AltRegistry with no default registry configuration. |
|
AltRegistry(AltRegistry origRegistry)
Constructs a new AltRegistry with identical registration state to the provided registry. |
Method Summary | |
---|---|
OutputGenerator<?> |
getGenerator(AltFormat altFormat)
Returns the OutputGenerator for the provided format or null
if the format is not registered. |
InputParser<?> |
getParser(AltFormat altFormat)
Returns the InputParser for a format or null if the format
is not registered or does not support input parsing. |
boolean |
hasSameHandlers(AltRegistry targetRegistry,
AltFormat altFormat)
Returns true has an identical registration with the target
registry for the specified alt format. |
void |
lock()
Locks the registry against further changes. |
AltFormat |
lookupName(java.lang.String name)
Returns the alt format that has been registered with the specified name. |
AltFormat |
lookupType(ContentType contentType)
Returns the alt format that has been registered with the specified content type. |
void |
register(AltFormat format,
InputParser<?> parser,
OutputGenerator<?> generator)
Registers the configuration for an AltFormat , replacing any
existing configuration for the format in the registry. |
java.util.Collection<AltFormat> |
registeredFormats()
Returns a collection of all registered formats in the registry. |
void |
setDelegate(AltRegistry delegate)
Sets a delegate registry that will be used to satisfy lookups that cannot be resolved from the local registry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AltRegistry()
public AltRegistry(AltRegistry origRegistry)
null
, a clean registry
will be created.
origRegistry
- registry containing default configuration that will be
used for lookups that can't be satisfied by the local registry.Method Detail |
---|
public void register(AltFormat format, InputParser<?> parser, OutputGenerator<?> generator)
AltFormat
, replacing any
existing configuration for the format in the registry.
format
- format to registerparser
- input parser to use for the format (or null
if not
supported for input.generator
- output generator to use for the format.
java.lang.IllegalStateException
- if registry has been locked.public void lock()
register(AltFormat, InputParser, OutputGenerator)
API
after lock has been called will fail.
public AltFormat lookupName(java.lang.String name)
name
- format name.
null
.public AltFormat lookupType(ContentType contentType)
contentType
- type to look up.
null
.public java.util.Collection<AltFormat> registeredFormats()
public InputParser<?> getParser(AltFormat altFormat)
InputParser
for a format or null
if the format
is not registered or does not support input parsing.
altFormat
- format to locate parser for.
null
.public OutputGenerator<?> getGenerator(AltFormat altFormat)
OutputGenerator
for the provided format or null
if the format is not registered.
altFormat
- format to locate generator for.
null
.public void setDelegate(AltRegistry delegate)
delegate
- delegate registry.public boolean hasSameHandlers(AltRegistry targetRegistry, AltFormat altFormat)
true
has an identical registration with the target
registry for the specified alt format. Currently, this is only true if
the copy constructor was used to do the initial registration and no
subsequent changes have been made.
targetRegistry
- target registry to testaltFormat
- alt format to test
true
if registration for format is the same.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |