1 17 18 package org.objectweb.jac.core.rtti; 19 20 import java.lang.reflect.*; 21 22 45 46 public abstract class MetaItemDelegate extends MetaItem { 47 48 50 protected Object delegate; 51 52 53 protected MetaItemDelegate parent = null; 54 55 public Object getDelegate() { 56 return delegate; 57 } 58 59 69 public final void setParent(MetaItemDelegate parent) 70 throws InvalidParentException 71 { 72 if ( ! (parent.getClass() == ClassItem.class) ) { 73 throw new InvalidParentException(); 74 } 75 this.parent = parent; 76 } 77 78 83 public final MetaItemDelegate getParent() { 84 return parent; 85 } 86 87 93 public MetaItemDelegate(Object delegate) throws InvalidDelegateException { 94 if (! (delegate instanceof Member) && ! (delegate instanceof Class )) { 95 throw new InvalidDelegateException(delegate, "must be a Member or a Class"); 96 } 97 this.delegate = delegate; 98 } 99 100 public MetaItemDelegate() { 101 delegate = null; 102 } 103 104 110 public int getModifiers() { 111 return ((Member)delegate).getModifiers(); 112 } 113 114 120 public abstract Class getType(); 121 122 127 public String toString() { 128 return getName(); 129 } 130 131 } 132 133 class InvalidParentException extends Exception { 134 } 135 136 | Popular Tags |