Package org.eclipse.xtext.naming
Class DefaultDeclarativeQualifiedNameProvider
- java.lang.Object
-
- org.eclipse.xtext.naming.IQualifiedNameProvider.AbstractImpl
-
- org.eclipse.xtext.naming.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 aSimpleCache
. Under some circumstances, this may downgrade the performance. Clients may want to overridecomputeFullyQualifiedName(EObject)
orgetOrComputeFullyQualifiedName(EObject)
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.xtext.naming.IQualifiedNameProvider
IQualifiedNameProvider.AbstractImpl
-
-
Constructor Summary
Constructors Constructor Description DefaultDeclarativeQualifiedNameProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected QualifiedName
computeFullyQualifiedName(org.eclipse.emf.ecore.EObject obj)
Computes the fully qualified name for the given object, if any.protected QualifiedName
computeFullyQualifiedNameFromNameAttribute(org.eclipse.emf.ecore.EObject obj)
Tries to read anEAttribute
name
from the given object and appends that to its container's qualified name.protected IQualifiedNameConverter
getConverter()
Returns theIQualifiedNameConverter
that is used to convert a string which was read from a model to an instance ofQualifiedName
.QualifiedName
getFullyQualifiedName(org.eclipse.emf.ecore.EObject obj)
protected QualifiedName
getOrComputeFullyQualifiedName(org.eclipse.emf.ecore.EObject obj)
Tries to obtain the FQN of the given object from thecache
.protected com.google.common.base.Function<org.eclipse.emf.ecore.EObject,java.lang.String>
getResolver()
protected QualifiedName
qualifiedName(java.lang.Object ele)
Default for qualifiedName dispatcher.-
Methods inherited from class org.eclipse.xtext.naming.IQualifiedNameProvider.AbstractImpl
apply
-
-
-
-
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 thisIQualifiedNameProvider
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 thecache
. 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
-
getConverter
protected IQualifiedNameConverter getConverter()
Returns theIQualifiedNameConverter
that is used to convert a string which was read from a model to an instance ofQualifiedName
.
-
computeFullyQualifiedName
protected QualifiedName computeFullyQualifiedName(org.eclipse.emf.ecore.EObject obj)
Computes the fully qualified name for the given object, if any. Uses the reflectivePolymorphicDispatcher
on the method namequalifiedName(Object)
. If there is no such reflective name found, it tries to read anEAttribute
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 anEAttribute
name
from the given object and appends that to its container's qualified name.- Since:
- 2.15
-
-