001 /*
002 * Licensed under the Apache License, Version 2.0 (the "License");
003 * you may not use this file except in compliance with the License.
004 * You may obtain a copy of the License at
005 *
006 * http://www.apache.org/licenses/LICENSE-2.0
007 *
008 * Unless required by applicable law or agreed to in writing, software
009 * distributed under the License is distributed on an "AS IS" BASIS,
010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
011 * See the License for the specific language governing permissions and
012 * limitations under the License.
013 */
014 package org.apache.commons.classscan;
015
016 import java.net.URL;
017 import java.util.Iterator;
018
019 /**
020 * A single location in a ClassPath. The location might be a jar or a directory.
021 * In enterprise application environments, the location might be an exploded ear or a war.
022 */
023 public interface ClassPathElement extends Iterable<ClassFile> {
024 /**
025 * Get a Iterator over the files specified by this instance
026 */
027 @Override
028 Iterator<ClassFile> iterator();
029
030 /**
031 * Get the location of the class bytes.
032 * This value is intended to be used as an argument to the {@link URL#URL(String) URL constructor}.
033 */
034 String getLocation();
035
036 /**
037 * Get a file with a particular name
038 *
039 * @param fileName The name of the desired file (this may be a path such as META-INF/resources/com.example.group.interface)
040 * @return null, if not found; otherwise the ResourceFile
041 */
042 ResourceFile getResource(String fileName);
043 }