public static XMLDescriptor buildDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(MWContainerAccessor.class); InheritancePolicy ip = (InheritancePolicy) descriptor.getInheritancePolicy(); ip.setClassIndicatorFieldName("@type"); ip.addClassIndicator(MWAttributeContainerAccessor.class, "attribute-based"); ip.addClassIndicator(MWMethodContainerAccessor.class, "method-based"); return descriptor; }
public Expression getTypeClause() { if (typeExpression == null) { if (getDescriptor() != null && isDowncast()) { InheritancePolicy ip = this.getDescriptor().getInheritancePolicy(); if (ip .isChildDescriptor()) { // or use the isDowncast flag. Don't need to do anything if its // not a downcast // equivalent to // typeExpressionBase.type().in(this.getDescriptor().getInheritancePolicy().getChildClasses()) typeExpression = ip.getWithAllSubclassesExpression(); if (typeExpression == null) { typeExpression = typeExpressionBase.type().equal(this.getDescriptor().getJavaClass()); } else { typeExpression = this.typeExpressionBase.twist(typeExpression, typeExpressionBase); } } } else { typeExpression = this.getBuilder(); // equivalent to an empty expression. } } return typeExpression; }