Package org.jboss.weld.serialization.spi
Interface ProxyServices
-
- All Superinterfaces:
Service
public interface ProxyServices extends Service
Support services related to proxy generation and serialization which are required to be implemented by all containers.
These services are used by all Weld proxy classes to ensure the correct class loaders are used and to aid in the serialization and deserialization of these classes across container instances.
Required in all environments since proxies are always in use. If no such service is provided by integrator, a default implementation will be used which will use the information extracted directly from the type of proxy.
ProxyServices
is a per-deployment service.- Author:
- David Allen, Matej Novotny
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default Class<?>
defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len)
Given a base type (class or interface), define a proxy class for this type.default Class<?>
defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len, ProtectionDomain protectionDomain)
Given a base type (class or interface), define a proxy class for this type.default Class<?>
loadClass(Class<?> originalClass, String classBinaryName)
Given a base type (class or interface), attempts to load a proxy of that class.
-
-
-
Method Detail
-
defineClass
default Class<?> defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len) throws ClassFormatError
Given a base type (class or interface), define a proxy class for this type. Integrators should use the base type to determine a properClassLoader
instance to forward creation to. MimicsClassLoader.defineClass(String name, byte[] b, int off, int len)
. Returns the created class object or throws an exception if there data are not valid or if there is any other problem registering the class with theClassLoader
.- Parameters:
originalClass
- The base type (class or interface) being proxiedclassName
- The binary name of the classclassBytes
- The bytes that make up the class dataoff
- The start offset in classBytes of the class datalen
- The length of the class data- Returns:
- The
Class
object created from the data - Throws:
ClassFormatError
- If the data did not contain a valid class
-
defineClass
default Class<?> defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len, ProtectionDomain protectionDomain) throws ClassFormatError
Given a base type (class or interface), define a proxy class for this type. Integrators should use the base type to determine a properClassLoader
instance to forward creation to. TheProtectionDomain
passed as an argument can be null (see default implementation of the seconddefineClass()
method). In such a case a newProtectionDomain
should be derived from the originalClass. MimicsClassLoader.defineClass(String name, byte[] b, int off, int len, ProtectionDomain domain)
. Returns the created class object or throws an exception if there data are not valid or if there is any other problem registering the class with theClassLoader
.- Parameters:
originalClass
- The base type (class or interface) being proxiedclassName
- The binary name of the classclassBytes
- The bytes that make up the class dataoff
- The start offset in classBytes of the class datalen
- The length of the class dataprotectionDomain
- The ProtectionDomain of the class or null- Returns:
- The
Class
object created from the data - Throws:
ClassFormatError
- If the data did not contain a valid class
-
loadClass
default Class<?> loadClass(Class<?> originalClass, String classBinaryName) throws ClassNotFoundException
Given a base type (class or interface), attempts to load a proxy of that class. Integrators should use the base type to determine properClassLoader
instance to query.- Parameters:
originalClass
- The base type (class or interface) whose proxy we try to loadclassBinaryName
- The binary name of the class- Returns:
- The
Class
object for given binary name of the class - Throws:
ClassNotFoundException
- If the class was not found
-
-