Class WovenClassImpl
- All Implemented Interfaces:
Iterable<String>, Collection<String>, List<String>, WovenClass
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]private final Stringprivate Classprivate booleanprivate intprivate final BundleWiringFields inherited from interface WovenClass
DEFINE_FAILED, DEFINED, TRANSFORMED, TRANSFORMING, TRANSFORMING_FAILED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) byte[]voidbooleanbooleanaddAll(int i, Collection<? extends String> collection) booleanaddAll(Collection<? extends String> collection) private voidvoidclear()(package private) void(package private) voidcompleteDefine(Class definedClass) (package private) voidcompleteImports(List<String> imports) booleanbooleancontainsAll(Collection<?> collection) get(int i) Returns the bundle wiring whose class loader will define the woven class.byte[]getBytes()Returns the class file bytes to be used to define thenamedclass.Returns the fully qualified name of the class being woven.Class<?> Returns the class defined by this woven class.Returns the list of dynamic import package descriptions to add to thebundle wiringfor this woven class.Returns the protection domain to which the woven class will be assigned when it is defined.intgetState()Returns the current state of this woven class.intbooleanisEmpty()booleanReturns whether weaving is complete in this woven class.iterator()intlistIterator(int i) remove(int i) booleanbooleanremoveAll(Collection<?> collection) booleanretainAll(Collection<?> collection) voidsetBytes(byte[] bytes) Set the class file bytes to be used to define thenamedclass.voidsetState(int state) intsize()subList(int i, int i1) Object[]toArray()<T> T[]toArray(T[] ts) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Collection
parallelStream, removeIf, streamMethods inherited from interface List
equals, hashCode, replaceAll, sort, spliterator
-
Field Details
-
m_className
-
m_wiring
-
m_bytes
private byte[] m_bytes -
m_imports
-
m_definedClass
-
m_isComplete
private boolean m_isComplete -
m_state
private int m_state
-
-
Constructor Details
-
WovenClassImpl
WovenClassImpl(String className, BundleWiring wiring, byte[] bytes)
-
-
Method Details
-
complete
-
completeImports
-
completeDefine
-
getBytes
public byte[] getBytes()Description copied from interface:WovenClassReturns the class file bytes to be used to define thenamedclass.While in the
WovenClass.TRANSFORMINGstate, this method returns a reference to the class files byte array contained in this object. After leaving theWovenClass.TRANSFORMINGstate, this woven class can no longer be transformed and a copy of the class file byte array is returned.- Specified by:
getBytesin interfaceWovenClass- Returns:
- The bytes to be used to define the
namedclass.
-
setBytes
public void setBytes(byte[] bytes) Description copied from interface:WovenClassSet the class file bytes to be used to define thenamedclass. This method must not be called outside invocations of theweavemethod by the framework.While in the
WovenClass.TRANSFORMINGstate, this method replaces the reference to the array contained in this object with the specified array. After leaving theWovenClass.TRANSFORMINGstate, this woven class can no longer be transformed and this method will throw anIllegalStateException.- Specified by:
setBytesin interfaceWovenClass- Parameters:
bytes- The new classfile that will be used to define thenamedclass. The specified array is retained by this object and the caller must not modify the specified array.
-
getDynamicImportsInternal
-
getDynamicImports
Description copied from interface:WovenClassReturns the list of dynamic import package descriptions to add to thebundle wiringfor this woven class. Changes made to the returned list will be visible to laterweaving hookscalled with this object. The returned list must not be modified outside invocations of theweavemethod by the framework.After leaving the
WovenClass.TRANSFORMINGstate, this woven class can no longer be transformed and the returned list will be unmodifiable.If the Java runtime environment supports permissions, any modification to the returned list requires
AdminPermission[bundle,WEAVE]. Additionally, any add or set modification requiresPackagePermission[package,IMPORT].- Specified by:
getDynamicImportsin interfaceWovenClass- Returns:
- A list containing zero or more dynamic import package
descriptions to add to the bundle wiring for this woven class.
This list must throw
IllegalArgumentExceptionif a malformed dynamic import package description is added. - See Also:
-
isWeavingComplete
public boolean isWeavingComplete()Description copied from interface:WovenClassReturns whether weaving is complete in this woven class. Weaving is complete after the class is defined.- Specified by:
isWeavingCompletein interfaceWovenClass- Returns:
trueifstateisWovenClass.DEFINED,WovenClass.TRANSFORMING_FAILEDorWovenClass.DEFINE_FAILED;falseotherwise.
-
getClassName
Description copied from interface:WovenClassReturns the fully qualified name of the class being woven.- Specified by:
getClassNamein interfaceWovenClass- Returns:
- The fully qualified name of the class being woven.
-
getProtectionDomain
Description copied from interface:WovenClassReturns the protection domain to which the woven class will be assigned when it is defined.- Specified by:
getProtectionDomainin interfaceWovenClass- Returns:
- The protection domain to which the woven class will be assigned
when it is defined, or
nullif no protection domain will be assigned.
-
getDefinedClass
Description copied from interface:WovenClassReturns the class defined by this woven class. During weaving, this method will returnnull. Once weaving iscomplete, this method will return the class object if this woven class was used to define the class.- Specified by:
getDefinedClassin interfaceWovenClass- Returns:
- The class associated with this woven class, or
nullif weaving is not complete, the class definition failed or this woven class was not used to define the class.
-
getBundleWiring
Description copied from interface:WovenClassReturns the bundle wiring whose class loader will define the woven class.- Specified by:
getBundleWiringin interfaceWovenClass- Returns:
- The bundle wiring whose class loader will define the woven class.
-
size
-
isEmpty
-
contains
-
iterator
-
toArray
-
toArray
-
add
-
checkImport
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<String>- Specified by:
containsAllin interfaceList<String>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
-
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<String>
-
listIterator
- Specified by:
listIteratorin interfaceList<String>
-
listIterator
- Specified by:
listIteratorin interfaceList<String>
-
subList
-
_getBytes
byte[] _getBytes() -
getState
public int getState()Description copied from interface:WovenClassReturns the current state of this woven class.A woven class can be in only one state at any time.
- Specified by:
getStatein interfaceWovenClass- Returns:
- Either
WovenClass.TRANSFORMING,WovenClass.TRANSFORMED,WovenClass.DEFINED,WovenClass.TRANSFORMING_FAILEDorWovenClass.DEFINE_FAILED.
-
setState
public void setState(int state)
-