1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 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.dexdeps; 18 19 import java.util.ArrayList; 20 21 public class ClassRef { 22 private String mClassName; 23 private ArrayList<FieldRef> mFieldRefs; 24 private ArrayList<MethodRef> mMethodRefs; 25 26 /** 27 * Initializes a new class reference. 28 */ ClassRef(String className)29 public ClassRef(String className) { 30 mClassName = className; 31 mFieldRefs = new ArrayList<FieldRef>(); 32 mMethodRefs = new ArrayList<MethodRef>(); 33 } 34 35 /** 36 * Adds the field to the field list. 37 */ addField(FieldRef fref)38 public void addField(FieldRef fref) { 39 mFieldRefs.add(fref); 40 } 41 42 /** 43 * Returns the field list as an array. 44 */ getFieldArray()45 public FieldRef[] getFieldArray() { 46 return mFieldRefs.toArray(new FieldRef[mFieldRefs.size()]); 47 } 48 49 /** 50 * Adds the method to the method list. 51 */ addMethod(MethodRef mref)52 public void addMethod(MethodRef mref) { 53 mMethodRefs.add(mref); 54 } 55 56 /** 57 * Returns the method list as an array. 58 */ getMethodArray()59 public MethodRef[] getMethodArray() { 60 return mMethodRefs.toArray(new MethodRef[mMethodRefs.size()]); 61 } 62 63 /** 64 * Gets the class name. 65 */ getName()66 public String getName() { 67 return mClassName; 68 } 69 } 70