org.eclipse.ocl.examples.common.label
Class LabelGeneratorRegistry

java.lang.Object
  extended by org.eclipse.ocl.examples.common.label.LabelGeneratorRegistry
All Implemented Interfaces:
ILabelGenerator.Registry

public class LabelGeneratorRegistry
extends java.lang.Object
implements ILabelGenerator.Registry

DebugString supports generation of debug identification of objects, determining a name usuing the following alternatives.
The null object is identified as
Implementers of IDebugString are identified by IDebugString.toDebugString();
MethodCall registrations in DebugUtils are identified by MethodCall.invoke().
Other objects are identified as

MethodCall registrations may be made via registerInstanceMethod or registerStaticMethod.

A debug string may be obtained via DebugString.toDebug(object).

DebugString providers string formatters for simple classes such as String, Number, Boolean and Ecore components such as EObject, Resource and ResourceSet.

User extensions should be registered prior to use. Beware that late registration can give misleading results since in the absence of an exact MethodCall registration the class hierarchy is search first for base classes then for instances for which there is an exact MethodCall match. This result is then cached and so may occlude a late registration.


Field Summary
protected  ILabelGenerator.Registry delegate
           
 
Fields inherited from interface org.eclipse.ocl.examples.common.label.ILabelGenerator.Registry
INSTANCE
 
Constructor Summary
LabelGeneratorRegistry()
          Construct a registry that resolves label generators locally.
LabelGeneratorRegistry(ILabelGenerator.Registry delegate)
          Construct a registry that resolves label generators locally when possible but which delegates to delegate otherwise.
 
Method Summary
<T> void
buildLabelFor(ILabelGenerator.Builder s, T labelledObject)
           
<T> void
buildSubLabelFor(ILabelGenerator.Builder labelBuilder, T labelledObject)
           
 ILabelGenerator.Builder createDefaultLabelBuilder(java.util.Map<ILabelGenerator.Option<?>,java.lang.Object> options)
           
static java.lang.String debugLabelFor(java.lang.Object object)
           
 ILabelGenerator<?> get(java.lang.Class<?> labelledClass)
           
 ILabelGenerator<?> get(java.lang.String labelledClass)
           
protected  ILabelGenerator<?> getLabelGenerator(java.lang.Class<?> cls)
           
static void initialize(ILabelGenerator.Registry registry)
           
 java.lang.Object install(java.lang.Class<?> labelledClass, ILabelGenerator<?> labelGenerator)
           
 java.lang.Object install(java.lang.String labelledClass, ILabelGenerator.Descriptor labelDescriptor)
           
 java.lang.Object install(java.lang.String labelledClass, ILabelGenerator<?> labelGenerator)
           
 java.lang.String labelFor(java.lang.Object labelledObject)
           
 java.lang.String labelFor(java.lang.Object labelledObject, java.util.Map<ILabelGenerator.Option<?>,java.lang.Object> options)
           
 java.lang.Object uninstall(java.lang.String labelledClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected final ILabelGenerator.Registry delegate
Constructor Detail

LabelGeneratorRegistry

public LabelGeneratorRegistry()
Construct a registry that resolves label generators locally.


LabelGeneratorRegistry

public LabelGeneratorRegistry(ILabelGenerator.Registry delegate)
Construct a registry that resolves label generators locally when possible but which delegates to delegate otherwise.

Method Detail

debugLabelFor

public static java.lang.String debugLabelFor(java.lang.Object object)

initialize

public static void initialize(ILabelGenerator.Registry registry)

buildLabelFor

public <T> void buildLabelFor(ILabelGenerator.Builder s,
                              T labelledObject)
Specified by:
buildLabelFor in interface ILabelGenerator.Registry

buildSubLabelFor

public <T> void buildSubLabelFor(ILabelGenerator.Builder labelBuilder,
                                 T labelledObject)
Specified by:
buildSubLabelFor in interface ILabelGenerator.Registry

createDefaultLabelBuilder

public ILabelGenerator.Builder createDefaultLabelBuilder(java.util.Map<ILabelGenerator.Option<?>,java.lang.Object> options)

get

public ILabelGenerator<?> get(java.lang.String labelledClass)
Specified by:
get in interface ILabelGenerator.Registry

get

public ILabelGenerator<?> get(java.lang.Class<?> labelledClass)

getLabelGenerator

protected ILabelGenerator<?> getLabelGenerator(java.lang.Class<?> cls)

install

public java.lang.Object install(java.lang.String labelledClass,
                                ILabelGenerator.Descriptor labelDescriptor)
Specified by:
install in interface ILabelGenerator.Registry

install

public java.lang.Object install(java.lang.String labelledClass,
                                ILabelGenerator<?> labelGenerator)
Specified by:
install in interface ILabelGenerator.Registry

install

public java.lang.Object install(java.lang.Class<?> labelledClass,
                                ILabelGenerator<?> labelGenerator)
Specified by:
install in interface ILabelGenerator.Registry

labelFor

public java.lang.String labelFor(java.lang.Object labelledObject)
Specified by:
labelFor in interface ILabelGenerator.Registry

labelFor

public java.lang.String labelFor(java.lang.Object labelledObject,
                                 java.util.Map<ILabelGenerator.Option<?>,java.lang.Object> options)
Specified by:
labelFor in interface ILabelGenerator.Registry

uninstall

public java.lang.Object uninstall(java.lang.String labelledClass)
Specified by:
uninstall in interface ILabelGenerator.Registry