001: /*
002: * Spoon - http://spoon.gforge.inria.fr/
003: * Copyright (C) 2006 INRIA Futurs <renaud.pawlak@inria.fr>
004: *
005: * This software is governed by the CeCILL-C License under French law and
006: * abiding by the rules of distribution of free software. You can use, modify
007: * and/or redistribute the software under the terms of the CeCILL-C license as
008: * circulated by CEA, CNRS and INRIA at http://www.cecill.info.
009: *
010: * This program is distributed in the hope that it will be useful, but WITHOUT
011: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012: * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details.
013: *
014: * The fact that you are presently reading this means that you have had
015: * knowledge of the CeCILL-C license and that you accept its terms.
016: */
017:
018: package spoon.support.reflect.code;
019:
020: import java.util.ArrayList;
021: import java.util.List;
022:
023: import spoon.reflect.code.CtExpression;
024: import spoon.reflect.code.CtNewClass;
025: import spoon.reflect.code.CtStatement;
026: import spoon.reflect.code.CtStatementList;
027: import spoon.reflect.declaration.CtClass;
028: import spoon.reflect.declaration.CtElement;
029: import spoon.reflect.reference.CtExecutableReference;
030: import spoon.reflect.visitor.CtVisitor;
031:
032: public class CtNewClassImpl<T> extends
033: CtTargetedExpressionImpl<T, CtExpression<?>> implements
034: CtNewClass<T> {
035: private static final long serialVersionUID = 1L;
036:
037: CtClass<?> annonymousClass;
038:
039: List<CtExpression<?>> arguments = new ArrayList<CtExpression<?>>();
040:
041: CtExecutableReference<T> executable;
042:
043: String label;
044:
045: public void accept(CtVisitor visitor) {
046: visitor.visitCtNewClass(this );
047: }
048:
049: public CtClass<?> getAnonymousClass() {
050: return annonymousClass;
051: }
052:
053: public List<CtExpression<?>> getArguments() {
054: return arguments;
055: }
056:
057: public CtExecutableReference<T> getExecutable() {
058: return executable;
059: }
060:
061: public String getLabel() {
062: return label;
063: }
064:
065: public void insertAfter(CtStatement statement) {
066: CtStatementImpl.insertAfter(this , statement);
067: }
068:
069: public void insertBefore(CtStatement statement) {
070: CtStatementImpl.insertBefore(this , statement);
071: }
072:
073: public void insertAfter(CtStatementList<?> statements) {
074: CtStatementImpl.insertAfter(this , statements);
075: }
076:
077: public void insertBefore(CtStatementList<?> statements) {
078: CtStatementImpl.insertBefore(this , statements);
079: }
080:
081: public void replace(CtElement element) {
082: if (element instanceof CtStatementList) {
083: CtStatementImpl.replace(this , (CtStatementList<?>) element);
084: } else {
085: super .replace(element);
086: }
087: }
088:
089: public void setAnonymousClass(CtClass<?> annonymousClass) {
090: this .annonymousClass = annonymousClass;
091: }
092:
093: public void setArguments(List<CtExpression<?>> arguments) {
094: this .arguments = arguments;
095: }
096:
097: public void setExecutable(CtExecutableReference<T> executable) {
098: this .executable = executable;
099: }
100:
101: public void setLabel(String label) {
102: this.label = label;
103: }
104:
105: }
|