Class DefaultDeclarativeQualifiedNameProvider

  • All Implemented Interfaces:
    com.google.common.base.Function<org.eclipse.emf.ecore.EObject,​QualifiedName>, java.util.function.Function<org.eclipse.emf.ecore.EObject,​QualifiedName>, IQualifiedNameProvider

    public class DefaultDeclarativeQualifiedNameProvider
    extends IQualifiedNameProvider.AbstractImpl
    Computes the fully qualified name of an EObject by first invoking a method
    QualifiedName qualifiedName(MyType ele)
    reflectively. And if no such method is found looks up a property 'name' and invokes the value and appends it to the eContainer's qualifiedName. The default implementation performs extensive caching by means of a SimpleCache. Under some circumstances, this may downgrade the performance. Clients may want to override computeFullyQualifiedName(EObject) or getOrComputeFullyQualifiedName(EObject).
    • Constructor Detail

      • DefaultDeclarativeQualifiedNameProvider

        public DefaultDeclarativeQualifiedNameProvider()
    • Method Detail

      • getResolver

        protected com.google.common.base.Function<org.eclipse.emf.ecore.EObject,​java.lang.String> getResolver()
      • getFullyQualifiedName

        public QualifiedName getFullyQualifiedName​(org.eclipse.emf.ecore.EObject obj)
        Returns:
        the qualified name for the given object, null if this IQualifiedNameProvider is not responsible or if the given object doesn't have qualified name.
      • getOrComputeFullyQualifiedName

        protected QualifiedName getOrComputeFullyQualifiedName​(org.eclipse.emf.ecore.EObject obj)
        Tries to obtain the FQN of the given object from the cache. If it is absent, it computes a new name.
        Since:
        2.15
        See Also:
        computeFullyQualifiedName(EObject)
      • qualifiedName

        protected QualifiedName qualifiedName​(java.lang.Object ele)
        Default for qualifiedName dispatcher. Write a method with this signature but custom Type for dispatching other types.
        Since:
        2.3
      • computeFullyQualifiedName

        protected QualifiedName computeFullyQualifiedName​(org.eclipse.emf.ecore.EObject obj)
        Computes the fully qualified name for the given object, if any. Uses the reflective PolymorphicDispatcher on the method name qualifiedName(Object). If there is no such reflective name found, it tries to read an EAttribute name from the given object and appends that to its containers qualified name.
        Since:
        2.15
        See Also:
        computeFullyQualifiedNameFromNameAttribute(EObject)
      • computeFullyQualifiedNameFromNameAttribute

        protected QualifiedName computeFullyQualifiedNameFromNameAttribute​(org.eclipse.emf.ecore.EObject obj)
        Tries to read an EAttribute name from the given object and appends that to its container's qualified name.
        Since:
        2.15