1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Eclipse Public License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.eclipse.org/org/documents/epl-v10.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ide.eclipse.adt.internal.sdk; 18 19 import java.io.IOException; 20 import java.util.ArrayList; 21 import java.util.HashMap; 22 23 import javax.management.InvalidAttributeValueException; 24 25 /** 26 * Classes which implements this interface provide methods to access framework resource 27 * data loaded from the SDK. 28 */ 29 interface IAndroidClassLoader { 30 31 /** 32 * Classes which implement this interface provide methods to describe a class. 33 */ 34 public interface IClassDescriptor { 35 36 String getFullClassName(); 37 38 IClassDescriptor getSuperclass(); 39 40 String getSimpleName(); 41 42 IClassDescriptor getEnclosingClass(); 43 44 IClassDescriptor[] getDeclaredClasses(); 45 46 boolean isInstantiable(); 47 } 48 49 /** 50 * Finds and loads all classes that derive from a given set of super classes. 51 * 52 * @param rootPackage Root package of classes to find. Use an empty string to find everyting. 53 * @param superClasses The super classes of all the classes to find. 54 * @return An hash map which keys are the super classes looked for and which values are 55 * ArrayList of the classes found. The array lists are always created for all the 56 * valid keys, they are simply empty if no deriving class is found for a given 57 * super class. 58 * @throws IOException 59 * @throws InvalidAttributeValueException 60 * @throws ClassFormatError 61 */ 62 public HashMap<String, ArrayList<IClassDescriptor>> findClassesDerivingFrom( 63 String rootPackage, String[] superClasses) 64 throws IOException, InvalidAttributeValueException, ClassFormatError; 65 66 /** 67 * Returns a {@link IClassDescriptor} by its fully-qualified name. 68 * @param className the fully-qualified name of the class to return. 69 * @throws ClassNotFoundException 70 */ 71 public IClassDescriptor getClass(String className) throws ClassNotFoundException; 72 73 /** 74 * Returns a string indicating the source of the classes, typically for debugging 75 * or in error messages. This would typically be a JAR file name or some kind of 76 * identifier that would mean something to the user when looking at error messages. 77 * 78 * @return An informal string representing the source of the classes. 79 */ 80 public String getSource(); 81 } 82