def.validateDefinition();
}
for (AttributeDef att : this.attributeDefs.values()) {
att.validateDefinition();
if (events.containsKey(att.getName())) {
throw new InvalidDefinitionException(String.format(
"Cannot define an attribute and register an event with the same name: %s", att.getName()),
getLocation());
}
}
for (AttributeDefRef facet : this.facets) {
facet.validateDefinition();
}
for (RegisterEventDef def : events.values()) {
def.validateDefinition();
}
for (EventHandlerDef def : eventHandlers) {
def.validateDefinition();
}
for (ImportDef def : imports) {
def.validateDefinition();
}
// an abstract component that you can't extend is pretty useless
if (this.isAbstract() && !this.isExtensible()) {
throw new InvalidDefinitionException(String.format(
"Abstract component %s must be extensible.", getDescriptor()), getLocation());
}
if (this.interfaces.contains(ROOT_MARKER)) {
// only aura has root access (this could be solved with namespace
// only visiblity of the rootComponent interface someday)
if (!"aura".equals(this.descriptor.getNamespace())) {
throw new InvalidDefinitionException(
String.format(
"Component %s cannot implement the rootComponent interface because it is not in the aura namespace",
getDescriptor()), getLocation());
}
// cannot be a root and extend something
if (this.extendsDescriptor != null) {
throw new InvalidDefinitionException(
String.format(
"Component %s cannot be a rootComponent and extend %s", getDescriptor(),
this.extendsDescriptor),
getLocation());
}