Java:Interface
Specification
Metaclass | Interface |
---|---|
Extends | Classifier |
Description | A named set of abstract methods that characterize the behavior of an element. |
All Superkinds | Classifier, Namespace, Type, Node, ModelElement |
---|
Specified In Edges
| ||||
---|---|---|---|---|
Inherited From | In Edge | Predecessor | Multiplicity | Description |
Classifier | InvokedType | DynamicCallSite | ✱ | Connects a DynamicCallSite or Invoke node to the declared type of the object whose Method is being invoked. |
Invoke | ✱
| |||
Supertype | Classifier | ✱ | Connects a Classifier to another Classifier that it extends. | |
Type | AliasedType | TypeAlias | ✱ | Connects a TypeAlias to the Type or TypeAlias it was declared to duplicate.
|
ArrayElementType | ArrayType | 0..1 | Connects an ArrayType to the Type of elements contained by arrays of that type. | |
C:CompletedBy | OpaqueType | 1 | Connects an OpaqueType to the complete definition of the corresponding Type. | |
ReferencedType | Pointer | ✱ | Connects a Pointer to the Type of the data pointed to. | |
Returns | Function | ✱ | Connects a Function to the Type of its return value (which may be Void). | |
TypeOf | Variable | ✱ | Links a Variable or DataFlow node to its Type
| |
DataFlow (Node) | ✱ |
Specified Out Edges
| ||||
---|---|---|---|---|
Inherited From | Out Edge | Successor | Multiplicity | Description |
Classifier | HasVariable | ProgramVariable | ✱ | Links a Classifier or Package to one of its Variables. |
InstanceVariable | ✱
| |||
Supertype | Classifier | ✱ | Connects a Classifier to another Classifier that it extends. | |
Type | TypeChecked | InstanceOf | ✱ | Connects a Type (usually a Classifier) to an InstanceOf test. |
Known Possible In Edges
| ||||
---|---|---|---|---|
Inherited From | In Edge | Predecessor | Multiplicity | Description |
Node | Contains | Node | 1 | Indicates that the predecessor contains the successor in a sense specified by the specific type of Contains edge. |
Known Possible Out Edges
| ||||
---|---|---|---|---|
Inherited From | Out Edge | Successor | Multiplicity | Description |
Namespace | HasVariable | Variable | ✱ | Links a Classifier or Package to one of its Variables. |
Node | Contains | Node | ✱ | Indicates that the predecessor contains the successor in a sense specified by the specific type of Contains edge. |
Semantics
The semantics of Interface are those common to UML [5, pp. 2-46, 2-66, 2-76], MS-IL [27, p. 140], and the JVM [36, p. 38, 2.7], extended to permit interfaces to include named constants (as in Java) and methods with class scope (as in MS-IL).
All of the features of an Interface must be abstract methods, named constants (attributes with changeability set to frozen), or methods with an ownerScope set to classifier.
All of the features defined by an Interface must be public.
An Interface definition cannot contain definitions of other model elements (such as classes, other interfaces, etc.).
An interface must also always be abstract (isAbstract, inherited from GeneralizableElement = true).
3.2.19.2 Language mappings
Interfaces are used to represent C++ classes (and structs) that define only pure virtual member functions, named constants, and static (class level) functions.
They map directly to Java interfaces, and to Java classes that contain only abstract methods.
Java interfaces may be marked as public, making them visible to any code that has access to the package in which they appear. If an interface is not declared public then it is accessible only within the package in which it is declared.
In C++, all top level interface definitions are public unless they appear in a nonpublic namespace.