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
Direct Known Subclasses:
LabelGeneratorRegistry.Global

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.


Nested Class Summary
static class LabelGeneratorRegistry.Global
           
 
Field Summary
protected  ILabelGenerator.Registry delegate
           
 
Fields inherited from interface org.eclipse.ocl.examples.common.label.ILabelGenerator.Registry
INSTANCE
 
Constructor Summary
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.lang.Object labelledObject, java.util.Map<ILabelGenerator.Option<?>,java.lang.Object> options)
           
static java.lang.String debugLabelFor(java.lang.Object object)
           
 ILabelGenerator<?> get(java.lang.Class<?> labelledClass)
           
protected  ILabelGenerator<?> getLabelGenerator(java.lang.Class<?> cls)
           
static LabelGeneratorRegistry init()
           
static void initialize(ILabelGenerator.Registry registry)
           
 java.lang.Object install(java.lang.Class<?> labelledClass, ILabelGenerator.Descriptor labelDescriptor)
           
 java.lang.Object install(java.lang.Class<?> 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)
           
 void uninstall(java.lang.Class<?> labelledClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

@Nullable
protected final ILabelGenerator.Registry delegate
Constructor Detail

LabelGeneratorRegistry

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

Method Detail

debugLabelFor

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

init

@NonNull
public static LabelGeneratorRegistry init()

initialize

public static void initialize(@NonNull
                              ILabelGenerator.Registry registry)

buildLabelFor

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

buildSubLabelFor

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

createDefaultLabelBuilder

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

get

@Nullable
public ILabelGenerator<?> get(@NonNull
                                       java.lang.Class<?> labelledClass)
Specified by:
get in interface ILabelGenerator.Registry

getLabelGenerator

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

install

@Nullable
public java.lang.Object install(@NonNull
                                         java.lang.Class<?> labelledClass,
                                         @NonNull
                                         ILabelGenerator.Descriptor labelDescriptor)
Specified by:
install in interface ILabelGenerator.Registry

install

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

labelFor

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

labelFor

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

uninstall

public void uninstall(@NonNull
                      java.lang.Class<?> labelledClass)
Specified by:
uninstall in interface ILabelGenerator.Registry