public class NamesAreUniqueValidationHelper extends java.lang.Object implements INamesAreUniqueValidationHelper
Constructor and Description |
---|
NamesAreUniqueValidationHelper() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkDescriptionForDuplicatedName(IEObjectDescription description,
java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Map<QualifiedName,IEObjectDescription>> clusterTypeToName,
ValidationMessageAcceptor acceptor) |
void |
checkUniqueNames(java.lang.Iterable<IEObjectDescription> descriptions,
CancelIndicator cancelIndicator,
ValidationMessageAcceptor acceptor)
Create errors for objects that have the same name.
|
void |
checkUniqueNames(java.lang.Iterable<IEObjectDescription> descriptions,
ValidationMessageAcceptor acceptor)
Create errors for objects that have the same name.
|
protected void |
createDuplicateNameError(IEObjectDescription description,
org.eclipse.emf.ecore.EClass clusterType,
ValidationMessageAcceptor acceptor) |
protected org.eclipse.emf.ecore.EClass |
getAssociatedClusterType(org.eclipse.emf.ecore.EClass eClass)
Return the type that describes the set of instances that should have unique names.
|
protected com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EClass> |
getClusterTypes()
Initialize the set of clustering types.
|
protected org.eclipse.emf.ecore.EObject |
getContainerForErrorMessage(org.eclipse.emf.ecore.EObject object) |
java.lang.String |
getDuplicateNameErrorMessage(IEObjectDescription description,
org.eclipse.emf.ecore.EClass clusterType,
org.eclipse.emf.ecore.EStructuralFeature feature)
Build the error message for duplicated names.
|
protected java.lang.String |
getErrorCode()
Returns
null . |
protected org.eclipse.emf.ecore.EStructuralFeature |
getNameFeature(org.eclipse.emf.ecore.EObject object) |
protected java.lang.String |
getTypeLabel(org.eclipse.emf.ecore.EClass eClass) |
protected boolean |
isContainerInformationHelpful(IEObjectDescription description,
org.eclipse.emf.ecore.EObject container,
java.lang.String containerTypeLabel,
org.eclipse.emf.ecore.EStructuralFeature containerNameFeature) |
protected boolean |
isContainerInformationHelpful(IEObjectDescription description,
java.lang.String shortName) |
protected com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EClass> getClusterTypes()
Initialize the set of clustering types. A type is considered to be clustering
if any instance of that type has to have a unique name when
it is transformed to an IEObjectDescription
.
Instances that do not belong to the same cluster may have the same exported name.
A clustering type will often be some kind of root type in a type hierarchy.
public void checkUniqueNames(java.lang.Iterable<IEObjectDescription> descriptions, ValidationMessageAcceptor acceptor)
INamesAreUniqueValidationHelper
checkUniqueNames
in interface INamesAreUniqueValidationHelper
INamesAreUniqueValidationHelper.checkUniqueNames(Iterable, CancelIndicator, ValidationMessageAcceptor)
public void checkUniqueNames(java.lang.Iterable<IEObjectDescription> descriptions, CancelIndicator cancelIndicator, ValidationMessageAcceptor acceptor)
Create errors for objects that have the same name. Objects, that do not belong to the same cluster will not get any errors. The cancel indicator may be used to interrupt the validation.
The cancel indicator will be queried everytime a description has been processed. It should provide a fast answer about its canceled state.checkUniqueNames
in interface INamesAreUniqueValidationHelper
protected void checkDescriptionForDuplicatedName(IEObjectDescription description, java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Map<QualifiedName,IEObjectDescription>> clusterTypeToName, ValidationMessageAcceptor acceptor)
protected void createDuplicateNameError(IEObjectDescription description, org.eclipse.emf.ecore.EClass clusterType, ValidationMessageAcceptor acceptor)
protected java.lang.String getErrorCode()
null
. Clients may override if they desire to attach an error code to the created errors.public java.lang.String getDuplicateNameErrorMessage(IEObjectDescription description, org.eclipse.emf.ecore.EClass clusterType, org.eclipse.emf.ecore.EStructuralFeature feature)
protected boolean isContainerInformationHelpful(IEObjectDescription description, org.eclipse.emf.ecore.EObject container, java.lang.String containerTypeLabel, org.eclipse.emf.ecore.EStructuralFeature containerNameFeature)
protected boolean isContainerInformationHelpful(IEObjectDescription description, java.lang.String shortName)
protected org.eclipse.emf.ecore.EObject getContainerForErrorMessage(org.eclipse.emf.ecore.EObject object)
protected java.lang.String getTypeLabel(org.eclipse.emf.ecore.EClass eClass)
protected org.eclipse.emf.ecore.EStructuralFeature getNameFeature(org.eclipse.emf.ecore.EObject object)
protected org.eclipse.emf.ecore.EClass getAssociatedClusterType(org.eclipse.emf.ecore.EClass eClass)
getClusterTypes()
).
Only the first super type will be taken into account when walking the hierarchy.