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    /**
020     * Representation of an import definition.
021     *
022     * @version $Id: ImportDef.java 18 2009-07-16 09:39:40Z user57 $
023     * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
024     */
025    public class ImportDef
026        extends Element
027    {
028        private boolean isStatic;
029    
030        private String packageName;
031    
032        private String type;
033    
034        private boolean wildcard;
035    
036        private String alias;
037    
038        public ImportDef() {}
039    
040        public ImportDef(final String packageName, final String type) {
041            setPackage(packageName);
042            setType(type);
043        }
044        
045        public boolean isStatic() {
046            return isStatic;
047        }
048    
049        public void setStatic(final boolean flag) {
050            this.isStatic = flag;
051        }
052    
053        public String getPackage() {
054            return packageName;
055        }
056    
057        public void setPackage(final String name) {
058            this.packageName = name;
059        }
060    
061        public String getType() {
062            return type;
063        }
064    
065        public void setType(final String type) {
066            this.type = type;
067        }
068    
069        public boolean isWildcard() {
070            return wildcard;
071        }
072    
073        public void setWildcard(final boolean flag) {
074            this.wildcard = flag;
075        }
076    
077        public String getAlias() {
078            return alias;
079        }
080    
081        public void setAlias(final String alias) {
082            this.alias = alias;
083        }
084    
085        public String getQualifiedName() {
086            StringBuffer buff = new StringBuffer();
087    
088            if (packageName != null) {
089                buff.append(packageName);
090    
091                if (type != null) {
092                    buff.append(".");
093                }
094            }
095    
096            if (type != null) {
097                buff.append(type);
098            }
099    
100            return buff.toString();
101        }
102    }