public EClass getRandomInstantiableSubClassOrSelf(EClass eType) { List<EClass> list = inheritedSubClasses.get(eType); EClass result = null; if (random.nextInt(list.size() + 1) == 0) { result = eType; } else { result = list.get(random.nextInt(list.size())); } if (result.isAbstract() || result.isInterface()) { return getRandomInstantiableSubClassOrSelf(eType); } else { return result; } } }
protected boolean makeClassElementDeclaration(EClass eClass) { return !eClass.isAbstract(); }
protected boolean makeClassElementDeclaration(EClass eClass) { return !eClass.isAbstract(); }
@Override protected boolean isMapped(EClass eClass) { return !eClass.isAbstract() && !eClass.isInterface(); }
/** * Returns whether this {@code ClassBean} represents an abstract class. * * @return {@code true} if this {@code ClassBean} represents an abstract class, {@code false} otherwise */ public boolean isAbstract() { return get().isAbstract(); }
/** * @since 3.0 */ protected AbstractCDORevision(EClass eClass) { if (eClass != null) { if (eClass.isAbstract()) { throw new IllegalArgumentException(MessageFormat.format(Messages.getString("AbstractCDORevision.0"), eClass)); //$NON-NLS-1$ } classInfo = CDOModelUtil.getClassInfo(eClass); } }
public boolean shouldSaveType(EClass objectType, EClass featureType, EStructuralFeature feature) { return objectType != featureType && (featureType.isAbstract() || feature.getEGenericType().getETypeParameter() != null); } }
public boolean shouldSaveType(EClass objectType, EClass featureType, EStructuralFeature feature) { return objectType != featureType && (featureType.isAbstract() || feature.getEGenericType().getETypeParameter() != null); } }
public EObject create(EClassifier classifier) { if (classifier == null) throw new NullPointerException("Classifier may not be null."); if (!(classifier instanceof EClass)) throw new IllegalArgumentException("Cannot create instance of datatype '" + classifier.getName() + "'"); EClass clazz = (EClass) classifier; if (clazz.isAbstract() || clazz.isInterface()) throw new IllegalArgumentException("Cannot create instance of abstract class '" + clazz.getName() + "'"); if (classifier.eIsProxy()) throw new IllegalStateException("Unresolved proxy "+((InternalEObject)classifier).eProxyURI()+". Make sure the EPackage has been registered."); return clazz.getEPackage().getEFactoryInstance().create(clazz); }
private boolean isInstantiatableSubType(EClass c, EClass superType) { return !c.isAbstract() && !c.isInterface() && EcoreUtil2.isAssignableFrom(superType, c); }
@Override public EObject createChild(EObject container, EReference reference, EClass clazz) throws ModelManipulationException { EClass containerClass = container.eClass(); Preconditions .checkArgument( !(containerClass.getEAllReferences().contains(container)), "The container of EClass %s does neither define or inherit an EReference %s.", containerClass.getName(), reference.getName()); Preconditions .checkArgument(reference.isContainment(), "Created elements must be inserted directly into the containment hierarchy."); Preconditions.checkArgument(!clazz.isAbstract(), "Cannot instantiate abstract EClass %s.", clazz.getName()); return doCreate(container, reference, clazz); }
public static Set<EClass> collectSubTypes(EClass type, boolean includeAbstract) { Set<EClass> result = new HashSet<EClass>(); Set<EPackage> siamPackages = collectSiamPackages(true); for (EPackage pkg : siamPackages) { for (EClassifier cls : pkg.getEClassifiers()) { if (cls instanceof EClass) { EClass c = (EClass)cls; if (type.isSuperTypeOf(c) && c.isAbstract() == includeAbstract) { result.add(c); } } } } return result; }
public boolean isAbstract() { // An interface should be abstract, but this makes sure of that fact. // return getEcoreClass().isAbstract() || getEcoreClass().isInterface(); }
public boolean isAbstract() { // An interface should be abstract, but this makes sure of that fact. // return getEcoreClass().isAbstract() || getEcoreClass().isInterface(); }
@Override public EObject createChild(EObject container, EReference reference, EClass clazz) throws ModelManipulationException { EClass containerClass = container.eClass(); Preconditions.checkArgument(!(containerClass.getEAllReferences().contains(container)), "The container of EClass %s does neither define or inherit an EReference %s.", containerClass.getName(), reference.getName()); Preconditions.checkArgument(reference.isContainment(), "Created elements must be inserted directly into the containment hierarchy."); Preconditions.checkArgument(!clazz.isAbstract(), "Cannot instantiate abstract EClass %s.", clazz.getName()); return doCreate(container, reference, clazz); }
public static void collectSourceCandidates(EClass eClass, Collection<EClass> concreteTypes, Map<EClass, List<EReference>> sourceCandidates) { if (!eClass.isAbstract() && !eClass.isInterface()) { for (EReference eReference : CDOModelUtil.getClassInfo(eClass).getAllPersistentReferences()) { collectSourceCandidates(eClass, eReference, concreteTypes, sourceCandidates); } } }
private EClass getDefaultType(DeserializationContext ctxt) { EClass type = null; EObject parent = EMFContext.getParent(ctxt); if (parent == null) { if (currentType != null && currentType != EObject.class) { type = EMFContext.findEClassByQualifiedName(ctxt, currentType.getCanonicalName()); } if (type == null) { type = EMFContext.getRoot(ctxt); } } else { EReference reference = (EReference) getFeature(ctxt); if (reference != null && !reference.getEReferenceType().isAbstract()) { type = reference.getEReferenceType(); } } return type; } }
private EClass getDefaultType(DeserializationContext ctxt) { EClass type = null; EObject parent = EMFContext.getParent(ctxt); if (parent == null) { if (currentType != null && currentType != EObject.class) { type = EMFContext.findEClassByQualifiedName(ctxt, currentType.getCanonicalName()); } if (type == null) { type = EMFContext.getRoot(ctxt); } } else { EReference reference = (EReference) getFeature(ctxt); if (reference != null && !reference.getEReferenceType().isAbstract()) { type = reference.getEReferenceType(); } } return type; } }
public GenFeature getRootFeature() { EClass documentRoot = getExtendedMetaData().getDocumentRoot(getEcorePackage()); if (documentRoot != null) { for (EStructuralFeature eStructuralFeature : getExtendedMetaData().getAllElements(documentRoot)) { if (eStructuralFeature instanceof EReference && !((EClass)eStructuralFeature.getEType()).isAbstract() && eStructuralFeature.isChangeable()) { return findGenFeature(eStructuralFeature); } } } return null; }
public GenFeature getRootFeature() { EClass documentRoot = getExtendedMetaData().getDocumentRoot(getEcorePackage()); if (documentRoot != null) { for (EStructuralFeature eStructuralFeature : getExtendedMetaData().getAllElements(documentRoot)) { if (eStructuralFeature instanceof EReference && !((EClass)eStructuralFeature.getEType()).isAbstract() && eStructuralFeature.isChangeable()) { return findGenFeature(eStructuralFeature); } } } return null; }