The org.eclipse.emf.ecore EClass isAbstract property defines whether a class can be instantiated or not. If the property value is true, the class cannot be directly instantiated but can only be used as a superclass to be extended by subclasses that can be instantiated.
Example 1: In a school management system, the Employee class can be marked as abstract as it cannot be directly instantiated, but the Teacher and Staff classes can be subclasses that extend the Employee class and can be instantiated.
Example 2: In a game development system, the GamePiece class can be marked abstract as it cannot be instantiated, but the Pawn and Knight classes can be subclasses that extend the GamePiece class and can be instantiated.
Code example:
// Create a new EClass EClass employeeClass = factory.createEClass(); employeeClass.setName("Employee"); employeeClass.setAbstract(true); // Set as abstract
// Create a new subclass for Employee EClass teacherClass = factory.createEClass(); teacherClass.setName("Teacher"); teacherClass.getESuperTypes().add(employeeClass); // Set Employee as superclass
// Create a new subclass for Employee EClass staffClass = factory.createEClass(); staffClass.setName("Staff"); staffClass.getESuperTypes().add(employeeClass); // Set Employee as superclass
Package library: The EClass isAbstract property is part of the Eclipse Modeling Framework (EMF) and is located in the org.eclipse.emf.ecore package library.
Java EClass.isAbstract - 18 examples found. These are the top rated real world Java examples of org.eclipse.emf.ecore.EClass.isAbstract extracted from open source projects. You can rate examples to help us improve the quality of examples.