001    /*
002     * Copyright (C) 2006-2007 the original author or authors.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.codehaus.gmaven.runtime.support.stubgen.model;
018    
019    import java.util.LinkedHashSet;
020    import java.util.Set;
021    
022    /**
023     * Representation of a constructor definition.
024     *
025     * @version $Id: ConstructorDef.java 18 2009-07-16 09:39:40Z user57 $
026     * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
027     */
028    public class ConstructorDef
029        extends MethodDef
030    {
031        public static final String SUPER = "super";
032    
033        public static final String THIS = "this";
034        
035        private final boolean magic;
036    
037        private String superType;
038    
039        private final Set superParameters = new LinkedHashSet();
040    
041        public ConstructorDef() {
042            this(false);
043        }
044    
045        public ConstructorDef(final boolean magic) {
046            super(Type.CTOR);
047    
048            this.magic = magic;
049        }
050    
051        public boolean isMagic() {
052            return magic;
053        }
054    
055        public TypeDef getReturns() {
056            throw new UnsupportedOperationException();
057        }
058    
059        public void setReturns(final TypeDef returns) {
060            throw new UnsupportedOperationException();
061        }
062    
063        public String getName() {
064            return getParent().getName();    
065        }
066    
067        public void setName(final String name) {
068            throw new UnsupportedOperationException();
069        }
070    
071        public String getSuperType() {
072            return superType;
073        }
074    
075        public void setSuperType(final String type) {
076            this.superType = type;
077        }
078    
079        public Set getSuperParameters() {
080            return superParameters;
081        }
082    
083        public void addSuperParameter(final SuperParameterDef def) {
084            assert def != null;
085    
086            def.setParent(this);
087            superParameters.add(def);
088        }
089    }