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.reflect.declaration;
019:
020: import java.util.Set;
021:
022: import spoon.reflect.reference.CtPackageReference;
023:
024: /**
025: * This element defines a package declaration. The packages are represented by a
026: * tree.
027: */
028: public interface CtPackage extends CtNamedElement {
029:
030: /**
031: * The separator for a string representation of a package.
032: */
033: public static final String PACKAGE_SEPARATOR = ".";
034:
035: /**
036: * The name for the top level package (default is "unnamed package").
037: */
038: public static final String TOP_LEVEL_PACKAGE_NAME = "unnamed package";
039:
040: /**
041: * Gets the declaring package of the current one.
042: */
043: CtPackage getDeclaringPackage();
044:
045: /**
046: * Searches a child package by name.
047: *
048: * @param name
049: * the simple name of searched package
050: * @return the found package or null
051: */
052: CtPackage getPackage(String name);
053:
054: /**
055: * Gets the set of included child packages.
056: */
057: Set<CtPackage> getPackages();
058:
059: /**
060: * Returns the fully qualified name of this package. This is also known as
061: * the package's <i>canonical</i> name.
062: *
063: * @return the fully qualified name of this package, or the empty string if
064: * this is the unnamed package
065: */
066: String getQualifiedName();
067:
068: /*
069: * (non-Javadoc)
070: *
071: * @see spoon.reflect.declaration.CtNamedElement#getReference()
072: */
073: CtPackageReference getReference();
074:
075: /**
076: * Finds a top-level type by name.
077: *
078: * @return the found type or null
079: */
080: CtSimpleType<?> getType(String simpleName);
081:
082: /**
083: * Returns the set of the top-level types in this package.
084: */
085: Set<CtSimpleType<?>> getTypes();
086:
087: /**
088: * Sets the childs defined in this package
089: *
090: * @param pack
091: * new set of child packages
092: */
093: void setPackages(Set<CtPackage> pack);
094:
095: /**
096: * Sets the types defined in the package.
097: *
098: * @param types
099: * new Set of types
100: */
101: void setTypes(Set<CtSimpleType<?>> types);
102: }
|