public interface MClass
The MClass services are obviously a subset of those provided by SmClass. This is because external programmers are not expected to modify the metamodel and therefore only limited 'get-like' accessors are provided.
The metaclass qualified name is the concatenation of the metamodel fragment, the '.' character and the metaclass name.
It is advised to use the qualified name when looking for a metaclass in the case several metamodel fragments define a metaclass with the same name.
Modifier and Type | Field and Description |
---|---|
static char |
QUALIFIER_SEP
qualified name separator between the fragment name and the metaclass name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
areOrphansAllowed()
Tells whether this metaclass may have orphan model objects.
|
MAttribute |
getAttribute(java.lang.String name)
Get the attribute with the given name.
|
java.util.List<MAttribute> |
getAttributes(boolean includeInherited)
Get the class attributes.
|
java.util.List<MDependency> |
getDependencies(boolean includeInherited)
Get all defined metamodel dependencies
|
MDependency |
getDependency(java.lang.String name)
Get the metamodel dependency with the given name.
|
java.lang.Class<? extends MObject> |
getJavaInterface()
Get the interface implemented by all objects of this metaclass.
|
java.util.Collection<MDependency> |
getLinkMetaclassSources()
Get for a link metaclass all source dependencies.
|
java.util.Collection<MDependency> |
getLinkMetaclassTargets()
Get for a link metaclass all target dependencies.
|
MMetamodel |
getMetamodel()
Return the metamodel owning this metaclass (the metamodel who loaded it and registered its providing fragment)
|
java.lang.String |
getName() |
MMetamodelFragment |
getOrigin()
Get the metamodel fragment providing this metaclass.
|
java.lang.String |
getQualifiedName()
Get the metaclass qualified name.
|
java.util.List<MClass> |
getSub(boolean recursive)
Get the sub classes.
|
MClass |
getSuper()
Get the parent metamodel class.
|
Version |
getVersion()
Get the metaclass version.
|
boolean |
hasBase(MClass parent)
Check that
this metaclass is a sub-metaclass of parent metaclass. |
boolean |
isAbstract() |
boolean |
isCmsNode()
Tells whether this metamodel class is a CMS node.
|
boolean |
isEnabled() |
boolean |
isFake()
Tells whether this metaclass is a fake metaclass.
|
default boolean |
isInstance(MObject obj)
Tells whether the model object is an instance of this metaclass or a sub metaclass.
|
boolean |
isLinkMetaclass()
Tells whether this metaclass is a relationship metaclass.
|
static final char QUALIFIER_SEP
boolean areOrphansAllowed()
MAttribute getAttribute(java.lang.String name)
name
- an attribute name.null
.java.util.List<MAttribute> getAttributes(boolean includeInherited)
includeInherited
- true
to include inherited attributes.java.util.List<MDependency> getDependencies(boolean includeInherited)
includeInherited
- true
to include inherited metamodel dependency.MDependency getDependency(java.lang.String name)
name
- a metamodel dependency name.null
.java.lang.Class<? extends MObject> getJavaInterface()
java.util.Collection<MDependency> getLinkMetaclassSources()
Also return inherited source dependencies. Returns an empty collection for node metaclasses.
java.util.Collection<MDependency> getLinkMetaclassTargets()
Also return inherited target dependencies. Returns an empty collection for node metaclasses.
MMetamodel getMetamodel()
java.lang.String getName()
MMetamodelFragment getOrigin()
java.lang.String getQualifiedName()
The metaclass qualified name is the concatenation of the metamodel fragment, the '.' character and the metaclass name.
It is advised to use the qualified name when looking for a metaclass in the case several metamodel fragments define a metaclass with the same name.
java.util.List<MClass> getSub(boolean recursive)
recursive
- true
to include all sub classe recursively.MClass getSuper()
Version getVersion()
This may be used to detect changes in the metamodel
boolean hasBase(MClass parent)
this
metaclass is a sub-metaclass of parent
metaclass.parent
- a metamodel classtrue
if this
class inherits from the given class. false
otherwise.boolean isAbstract()
true
if the class is abstract.boolean isCmsNode()
CMS nodes define a structuring unit for some storages implementations. For EXML repositories, a CMS node represents an EXML file.
true
if the class is a CMS node.boolean isFake()
A fake metaclass is a shell metaclass that represents a missing metaclass. Fake metaclass model objects are all shell objects.
boolean isLinkMetaclass()
A relationship metaclass elements represents links between other objects. They have source and target MDependencies.
boolean isEnabled()
default boolean isInstance(MObject obj)
obj
- a model object or null.