001/* 002 * Copyright (C) 2010 The Android Open Source Project 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.android.dexdeps; 018 019import java.util.ArrayList; 020 021public class ClassRef { 022 private String mClassName; 023 private ArrayList<FieldRef> mFieldRefs; 024 private ArrayList<MethodRef> mMethodRefs; 025 026 /** 027 * Initializes a new class reference. 028 */ 029 public ClassRef(String className) { 030 mClassName = className; 031 mFieldRefs = new ArrayList<FieldRef>(); 032 mMethodRefs = new ArrayList<MethodRef>(); 033 } 034 035 /** 036 * Adds the field to the field list. 037 */ 038 public void addField(FieldRef fref) { 039 mFieldRefs.add(fref); 040 } 041 042 /** 043 * Returns the field list as an array. 044 */ 045 public FieldRef[] getFieldArray() { 046 return mFieldRefs.toArray(new FieldRef[mFieldRefs.size()]); 047 } 048 049 /** 050 * Adds the method to the method list. 051 */ 052 public void addMethod(MethodRef mref) { 053 mMethodRefs.add(mref); 054 } 055 056 /** 057 * Returns the method list as an array. 058 */ 059 public MethodRef[] getMethodArray() { 060 return mMethodRefs.toArray(new MethodRef[mMethodRefs.size()]); 061 } 062 063 /** 064 * Gets the class name. 065 */ 066 public String getName() { 067 return mClassName; 068 } 069}