Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.lang.reflect: Javadoc index of package java.lang.reflect.


Package Samples:

java.lang.reflect

Classes:

Proxy: This class allows you to dynamically create an instance of any (or even multiple) interfaces by reflection, and decide at runtime how that instance will behave by giving it an appropriate InvocationHandler . Proxy classes serialize specially, so that the proxy object can be reused between VMs, without requiring a persistent copy of the generated class code. Creation To create a proxy for some interface Foo: InvocationHandler handler = new MyInvocationHandler(...); Class proxyClass = Proxy.getProxyClass( Foo.class.getClassLoader(), new Class[] { Foo.class }); Foo f = (Foo) proxyClass .getConstructor(new ...
InvocationHandler: This interface defines an invocation handler. Suppose you are using reflection, and found a method that requires that its parameter be an object of a given interface. You want to call this method, but have no idea what classes implement that interface. So, you can create a Proxy instance, a convenient way to dynamically generate a class that meets all the necessary properties of that interface. But in order for the proxy instance to do any good, it needs to know what to do when interface methods are invoked! So, this interface is basically a cool wrapper that provides runtime code generation needed ...
Array: Array holds static helper functions that allow you to create and manipulate arrays by reflection. Operations know how to perform widening conversions, but throw java.lang.IllegalArgumentException if you attempt a narrowing conversion. Also, when accessing primitive arrays, this class performs object wrapping and unwrapping as necessary. Note: This class returns and accepts types as Classes, even primitive types; there are Class types defined that represent each different primitive type. They are java.lang.Boolean.TYPE, java.lang.Byte.TYPE, , also available as boolean.class, byte.class , etc. These ...
Field: The Field class represents a member variable of a class. It also allows dynamic access to a member, via reflection. This works for both static and instance fields. Operations on Field objects know how to do widening conversions, but throw java.lang.IllegalArgumentException if a narrowing conversion would be necessary. You can query for information on this Field regardless of location, but get and set access may be limited by Java language access controls. If you can't do it in the compiler, you can't normally do it here either. Note: This class returns and accepts types as Classes, even primitive ...
Method: The Method class represents a member method of a class. It also allows dynamic invocation, via reflection. This works for both static and instance methods. Invocation on Method objects knows how to do widening conversions, but throws java.lang.IllegalArgumentException if a narrowing conversion would be necessary. You can query for information on this Method regardless of location, but invocation access may be limited by Java language access controls. If you can't do it in the compiler, you can't normally do it here either. Note: This class returns and accepts types as Classes, even primitive types; ...
Constructor: The Constructor class represents a constructor of a class. It also allows dynamic creation of an object, via reflection. Invocation on Constructor objects knows how to do widening conversions, but throws java.lang.IllegalArgumentException if a narrowing conversion would be necessary. You can query for information on this Constructor regardless of location, but construction access may be limited by Java language access controls. If you can't do it in the compiler, you can't normally do it here either. Note: This class returns and accepts types as Classes, even primitive types; there are Class types ...
ParameterizedType: Represents a type which is parameterized over one or more other types. For example, List<Integer> is a parameterized type, with List parameterized over the type Integer . Instances of this classes are created as needed, during reflection. On creating a parameterized type, p , the GenericTypeDeclaration corresponding to p is created and resolved. Each type argument of p is then created recursively; details of this process are availble in the documentation of TypeVariable . This creation process only happens once; repetition has no effect. Implementors of this interface must implement an appropriate ...
WildcardType: Represents a wildcard type expression, where the type variable is unnamed. The simplest example of this is ? , which represents any unbounded type. Another example is ? extends Number , which specifies any type which is a subclass of Number ( Number is the upper bound). ? super String gives the type a less common lower bound, which means that the type must be either a String or one of its superclasses. This can be useful in working with collections. You may want a method to add instances of a class to a collection with a more generic type (e.g. adding String s to a list of Object s), but don't ...
ReflectPermission: This class implements permissions for reflection. This is a named permission, and the only defined name is suppressAccessChecks, which allows suppression of normal Java objects when using reflection. Permission Target Name What Permission Allows Risk of Allowing Permission suppressAccessChecks Ability to access fields, invoke methods, and construct objects via reflection, including non-public members in contexts where such access is not legal at compile-time. This is dangerous. It exposes possibly confidential information, and malicious code could interfere with the internals of the Virtual Machine ...
AnnotatedElement: Represents an element that can be annotated. The methods of this interface provide reflection-based access to the annotations associated with a particular element, such as a class, field, method or package. Each annotation returned by these methods is both immutable and serializable. The returned arrays may be freely modified, without any effect on the arrays returned to future callers. If an annotation refers to a type or enumeration constant that is inaccessible, then a TypeNotPresentException or EnumConstantNotPresentException will be thrown. Likewise, invalid annotations will produce either ...
UndeclaredThrowableException: This exception class is thrown by a Proxy instance if the invoke 55 method of that instance's InvocationHandler attempts to throw an exception that not declared by the throws clauses of all of the interface methods that the proxy instance is implementing. When thrown by Proxy, this class will always wrap a checked exception, never java.lang.Error or java.lang.RuntimeException , which are unchecked.
TypeVariable: This is a common interface for all type variables provided by the Java language. Instances are created the first time a type variable is needed by one of the reflective methods declared in this package. Creating a type variable requires resolving the appropriate type. This may involve resolving other classes as a side effect (e.g. if the type is nested inside other classes). Creation should not involve resolving the bounds. Repeated creation has no effect; an equivalent instance is returned. Caching is not required, but all instances must be equal() to each other.
Modifier: Modifier is a helper class with static methods to determine whether an int returned from getModifiers() represents static, public, protected, native, final, etc... and provides an additional method to print out all of the modifiers in an int in order. The methods in this class use the bitmask values in the VM spec to determine the modifiers of an int. This means that a VM must return a standard mask, conformant with the VM spec. I don't know if this is how Sun does it, but I'm willing to bet money that it is.
AccessibleObject: This class is the superclass of various reflection classes, and allows sufficiently trusted code to bypass normal restrictions to do necessary things like invoke private methods outside of the class during Serialization. If you don't have a good reason to mess with this, don't try. Fortunately, there are adequate security checks before you can set a reflection object as accessible.
Type: Represents any Type within the Java programming language. This may be a primitive type (e.g. int , an array type (e.g. double[]>/code>), a raw type (e.g. Calendar ), a parameterized type (e.g. List<Boolean> , or a type variable (e.g. T extends String ).
InvocationTargetException: InvocationTargetException is sort of a way to "wrap" whatever exception comes up when a method or constructor is called via Reflection. As of JDK 1.4, it was retrofitted to match the exception chaining of all other exceptions, but getTargetException() still works.
MalformedParameterizedTypeException: This exception class is thrown when one of the reflection methods encountered an invalid parameterized type within the metadata of a class. One possible reason for this exception being thrown is the specification of too few or too many type variables.
GenericSignatureFormatError: Thrown on encountering a syntactically malformed signature in a reflective method. During reflection, the generic type signature of a type, method or constructor may be interpreted by the virtual machine. This error is thrown if this operation fails.
Member: Member is an interface that represents any member of a class (field or method) or a constructor. You can get information about the declaring class, name or modifiers of the member with this interface.
GenericDeclaration: Represents an entity that declares one or more type parameters. This includes classes and methods (including constructors).
GenericArrayType: Represents the type of an array's components, which may be either a parameterized type or a type variable.

Home | Contact Us | Privacy Policy | Terms of Service