EClass carClass = CarPackage.eINSTANCE.getCar(); for (EStructuralFeature feature : carClass.getEStructuralFeatures()) { System.out.println(feature.getName()); }
EClass personClass = PersonPackage.eINSTANCE.getPerson(); if (personClass.getEStructuralFeatures().isEmpty()) { System.out.println("There are no structural features for Person."); } else { System.out.println("Person has structural features."); }In this example, we retrieve the Person EClass from the PersonPackage and check if it has any structural features. If it does not have any features, we print a message to the console. These examples use the org.eclipse.emf.ecore package library, which is part of the Eclipse Modeling Framework (EMF). EMF is a modeling framework and code generation facility for building tools and other applications based on a structured data model.