jjg@451: /* ohair@554: * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. jjg@451: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jjg@451: * jjg@451: * This code is free software; you can redistribute it and/or modify it jjg@451: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this jjg@451: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. jjg@451: * jjg@451: * This code is distributed in the hope that it will be useful, but WITHOUT jjg@451: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jjg@451: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jjg@451: * version 2 for more details (a copy is included in the LICENSE file that jjg@451: * accompanied this code). jjg@451: * jjg@451: * You should have received a copy of the GNU General Public License version jjg@451: * 2 along with this work; if not, write to the Free Software Foundation, jjg@451: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jjg@451: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. jjg@451: */ jjg@451: jjg@451: package com.sun.tools.classfile; jjg@451: jjg@451: jjg@451: /** jjg@451: * A directed relationship between two {@link Dependency.Location Location}s. jjg@451: * Subtypes of {@code Dependency} may provide additional detail about the dependency. jjg@451: * jjg@451: * @see Dependency.Finder jjg@451: * @see Dependency.Filter jjg@451: * @see Dependencies jjg@451: */ jjg@451: public interface Dependency { jjg@451: /** jjg@451: * A filter used to select dependencies of interest, and to discard others. jjg@451: */ jjg@451: public interface Filter { jjg@451: /** jjg@451: * Return true if the dependency is of interest. jjg@451: * @param dependency the dependency to be considered jjg@451: * @return true if and only if the dependency is of interest. jjg@451: */ jjg@451: boolean accepts(Dependency dependency); jjg@451: } jjg@451: jjg@451: /** jjg@451: * An interface for finding the immediate dependencies of a given class file. jjg@451: */ jjg@451: public interface Finder { jjg@451: /** jjg@451: * Find the immediate dependencies of a given class file. jjg@451: * @param classfile the class file to be examined jjg@452: * @return the dependencies located in the given class file. jjg@451: */ jjg@451: public Iterable findDependencies(ClassFile classfile); jjg@451: } jjg@451: jjg@451: jjg@451: /** jjg@451: * A location somewhere within a class. Subtypes of {@code Location} jjg@451: * may be used to provide additional detail about the location. jjg@451: */ jjg@451: public interface Location { jjg@451: /** jjg@451: * Get the name of the class containing the location. jjg@451: * This name will be used to locate the class file for transitive jjg@451: * dependency analysis. jjg@451: * @return the name of the class containing the location. jjg@451: */ jjg@451: String getClassName(); jjg@451: } jjg@451: jjg@451: jjg@451: /** jjg@451: * Get the location that has the dependency. jjg@451: * @return the location that has the dependency. jjg@451: */ jjg@451: Location getOrigin(); jjg@451: jjg@451: /** jjg@451: * Get the location that is being depended upon. jjg@451: * @return the location that is being depended upon. jjg@451: */ jjg@451: Location getTarget(); jjg@451: } jjg@451: