/* * @see ASTVisitor#visit(SwitchStatement) */ public boolean visit(SwitchStatement node) { this.fBuffer.append("switch ("); // $NON-NLS-1$ node.getExpression().accept(this); this.fBuffer.append(") "); // $NON-NLS-1$ this.fBuffer.append("{"); // $NON-NLS-1$ for (Iterator it = node.statements().iterator(); it.hasNext(); ) { Statement s = (Statement) it.next(); s.accept(this); } this.fBuffer.append("}"); // $NON-NLS-1$ return false; }
protected List getFeatureMethodSwitch(String type) { List cases = featureSwitchMap.get(type); if (cases == null) { MethodDeclaration method = newMethodDeclaration( "void", type, newSingleVariableDeclaration(FeatureDescriptor.class.getName(), "featureDesc")); SwitchStatement switchStm = newSwitchStatement(newMethodInvocation("featureDesc", "getOrdinal")); method.getBody().statements().add(switchStm); addBodyDeclaration(method); featureSwitchMap.put(type, cases = switchStm.statements()); } return cases; }
protected List getMethodSwitch(String type) { List cases = switchMap.get(type); if (cases == null) { MethodDeclaration method = newMethodDeclaration( "void", type, newSingleVariableDeclaration( newParameterizedType(EntityDescriptor.class.getName(), ast.newWildcardType()), "entityDesc")); SwitchStatement switchStm = newSwitchStatement(newMethodInvocation("entityDesc", "getOrdinal")); method.getBody().statements().add(switchStm); addBodyDeclaration(method); switchMap.put(type, cases = switchStm.statements()); } return cases; }
protected List getEnumMethodSwitch(String type) { if (enumCases == null) { MethodDeclaration method = newMethodDeclaration( "void", "wEntity", newSingleVariableDeclaration( newParameterizedType(EntityDescriptor.class.getName(), ast.newWildcardType()), "entityDesc"), newSingleVariableDeclaration(EnumValue.class.getName(), "value")); SwitchStatement switchStm = newSwitchStatement(newMethodInvocation("entityDesc", "getOrdinal")); method.getBody().statements().add(switchStm); addBodyDeclaration(method); enumCases = switchStm.statements(); } return enumCases; }