KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > lang > reflect > AccessibleObject

java.lang.reflect
Class AccessibleObject

java.lang.Object
  extended by java.lang.reflect.AccessibleObject
All Implemented Interfaces:
AnnotatedElement
Direct Known Subclasses:
Constructor, Field, Method
See Also:
Top Examples, Source Code, ReflectPermission

protected AccessibleObject()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
See Also:
AnnotatedElement
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Annotation[] getAnnotations()
See Also:
AnnotatedElement
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Annotation[] getDeclaredAnnotations()
See Also:
AnnotatedElement
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isAccessible()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
See Also:
AnnotatedElement
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setAccessible(boolean flag)
                   throws SecurityException
See Also:
RuntimePermission, SecurityManager.checkPermission(java.security.Permission), Constructor, Class
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[701]Get all loaded classes
By Anonymous on 2004/03/15 18:20:17  Rate
/** 
  * * WARNING: this code is not portable. It depends on a particular PRIVATE * 
  * field of java.lang.ClassLoader implementation in Sun's JDK 1.2+ and 
  * IBM's JDK 1.3 * and having enough security privileges given to the 
  * caller. 
  */
 
 public static Class [  ]  getAllLoadedClasses ( final ClassLoader loader )   {  
     if  ( loader == null )   {  
         ClassLoader namespace = Thread.class.getClassLoader (  ) ; 
         // current classloader 
      }  
     System.out.println (  
         "looking into: " 
             + loader 
             + ", instanceof URLClassLoader: " 
             +  ( loader instanceof java.net.URLClassLoader )  ) ; 
     try  {  
         Field _classes = ClassLoader.class.getDeclaredField ( "classes" ) ; 
         _classes.setAccessible ( true ) ; 
         java.util.Vector _classesVector = 
              ( java.util.Vector )  _classes.get ( loader ) ; 
         Class [  ]  result = new Class [ _classesVector.size (  )  ] ; 
         _classesVector.copyInto ( result ) ; 
         return result; 
      }  catch  ( Exception e )   {  
         // not a canonical JDK implementation: can't do this 
         e.printStackTrace (  ) ; 
         return null; 
      }  
  }  
 


public static void setAccessible(AccessibleObject[] array,
                                 boolean flag)
                          throws SecurityException
See Also:
RuntimePermission, SecurityManager.checkPermission(java.security.Permission), Class, Constructor
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags