Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*     */ package org.jboss.aop;
  /*     */ 
  /*     */ import java.lang.reflect.Field;
  /*     */ import java.lang.reflect.Method;
  /*     */ import java.security.AccessController;
  /*     */ import java.security.PrivilegedActionException;
  /*     */ import java.security.PrivilegedExceptionAction;
  /*     */ import org.jboss.aop.joinpoint.FieldAccess;
  /*     */ import org.jboss.aop.joinpoint.FieldJoinpoint;
 /*     */ import org.jboss.aop.joinpoint.Joinpoint;
 /*     */ import org.jboss.aop.util.MethodHashing;
 /*     */ 
 /*     */ public class FieldInfo extends JoinPointInfo
 /*     */   implements FieldAccess
 /*     */ {
 /*     */   private int index;
 /*     */   private Field advisedField;
 /*     */   private Method wrapper;
 /*     */   private boolean read;
 /*     */ 
 /*     */   public FieldInfo()
 /*     */   {
 /*     */   }
 /*     */ 
 /*     */   public FieldInfo(Advisor advisorboolean read)
 /*     */   {
 /*  55 */     super(advisornull);
 /*  56 */     this. = read;
 /*     */   }
 /*     */ 
 /*     */   public FieldInfo(Class clazzint indexString fieldNamelong wrapperHashAdvisor advisorboolean read)
 /*     */   {
 /*  61 */     super(advisorclazz);
 /*     */     try
 /*     */     {
 /*  65 */       this. = index;
 /*  66 */       this. = (System.getSecurityManager() == null ? ..get(thisclazzfieldName) : ..get(thisclazzfieldName));
 /*     */ 
 /*  69 */       this. = MethodHashing.findMethodByHash(clazzwrapperHash);
 /*  70 */       setAdvisor(advisor);
 /*  71 */       this. = read;
 /*     */     }
 /*     */     catch (Exception e)
 /*     */     {
 /*  75 */       throw new RuntimeException(e);
 /*     */     }
 /*     */   }
 /*     */ 
 /*     */   private FieldInfo(FieldInfo other)
 /*     */   {
 /*  84 */     super(other);
 /*  85 */     this. = other.index;
 /*  86 */     this. = other.advisedField;
 /*  87 */     this. = other.wrapper;
 /*  88 */     this. = other.read;
 /*     */   }
 /*     */ 
 /*     */   protected Joinpoint internalGetJoinpoint()
 /*     */   {
 /*  93 */     return new FieldJoinpoint(this.);
 /*     */   }
 /*     */ 
 /*     */   public JoinPointInfo copy()
 /*     */   {
 /*  98 */     return new FieldInfo(this);
 /*     */   }
 /*     */ 
 /*     */   public String toString()
 /*     */   {
 /* 103 */     StringBuffer sb = new StringBuffer("Field ");
 /* 104 */     sb.append(this. ? " Read" : "Write");
 /* 105 */     sb.append("[");
 /* 106 */     sb.append("field=" + this.);
 /* 107 */     sb.append("]");
 /* 108 */     return sb.toString();
 /*     */   }
 /*     */ 
 /*     */   public void setIndex(int index)
 /*     */   {
 /* 113 */     this. = index;
 /*     */   }
 /*     */ 
 /*     */   public int getIndex()
 /*     */   {
 /* 118 */     return this.;
 /*     */   }
 /*     */ 
 /*     */   public void setAdvisedField(Field advisedField)
 /*     */   {
 /* 123 */     this. = advisedField;
 /*     */   }
 /*     */ 
 /*     */   @Deprecated
 /*     */   public Field getAdvisedField()
 /*     */   {
 /* 130 */     return this.;
 /*     */   }
 /*     */ 
 /*     */   public Field getField()
/*     */   {
/* 135 */     return this.;
/*     */   }
/*     */ 
/*     */   public void setWrapper(Method wrapper)
/*     */   {
/* 140 */     this. = wrapper;
/*     */   }
/*     */ 
/*     */   public Method getWrapper()
/*     */   {
/* 145 */     return this.;
/*     */   }
/*     */ 
/*     */   public void setRead(boolean read)
/*     */   {
/* 150 */     this. = read;
/*     */   }
/*     */ 
/*     */   public boolean isRead()
/*     */   {
/* 155 */     return this.;
/*     */   }
/*     */ 
/*     */   public Object resolveAnnotation(Class annotation)
/*     */   {
/* 160 */     Object val = super.resolveAnnotation(annotation);
/* 161 */     if (val != nullreturn val;
/*     */ 
/* 163 */     if (getAdvisor() != null)
/*     */     {
/* 165 */       val = getAdvisor().resolveAnnotation(this.annotation);
/* 166 */       if (val != nullreturn val;
/*     */     }
/*     */ 
/* 169 */     return null;
/*     */   }
/*     */ 
/*     */   private Field doGet(Class clazzString namethrows NoSuchFieldException
/*     */   {
/* 174 */     Field field = null;
/* 175 */     Class superClass = clazz;
/* 176 */     while (superClass != null)
/*     */     {
/*     */       try
/*     */       {
/* 180 */         field = superClass.getDeclaredField(name);
/*     */       }
/*     */       catch (NoSuchFieldException e)
/*     */       {
/*     */       }
/*     */ 
/* 187 */       superClass = superClass.getSuperclass();
/*     */     }
/*     */ 
/* 190 */     if (field == null)
/*     */     {
/* 192 */       throw new NoSuchFieldException("Cannot find field in " + clazz.getName() + " or any of its superclasses");
/*     */     }
/* 194 */     return field;
/*     */   }
/*     */ 
/*     */   static abstract interface GetDeclaredFieldAction
/*     */   {
/* 201 */     public static final GetDeclaredFieldAction PRIVILEGED = new GetDeclaredFieldAction()
/*     */     {
/*     */       public Field get(FieldInfo targetClass clazzString namethrows NoSuchFieldException {
/*     */         Exception ex;
/*     */         try {
/* 207 */           return (Field)AccessController.doPrivileged(new PrivilegedExceptionAction(targetclazzname)
/*     */           {
/*     */             public Object run() throws Exception
/*     */             {
/* 211 */               return this..doGet(this.this.);
/*     */             }
/*     */           });
/*     */         }
/*     */         catch (PrivilegedActionException e) {
/* 217 */           ex = e.getException();
/* 218 */           if ((ex instanceof NoSuchFieldException))
/*     */           {
/* 220 */             throw ((NoSuchFieldException)ex);
/*     */           }
/*     */         }
/* 222 */         throw new RuntimeException(ex);
/*     */       }
/* 201 */     };
/*     */ 
/* 227 */     public static final GetDeclaredFieldAction NON_PRIVILEGED = new GetDeclaredFieldAction()
/*     */     {
/*     */       public Field get(FieldInfo targetClass clazzString namethrows NoSuchFieldException
/*     */       {
/* 231 */         return target.doGet(clazzname);
/*     */       }
/* 227 */     };
/*     */ 
/*     */     public abstract Field get(FieldInfo paramFieldInfoClass paramClassString paramString)
/*     */       throws NoSuchFieldException;
/*     */   }
/*     */ }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
 * Qualified Name:     org.jboss.aop.FieldInfo
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X