Class WovenClassImpl

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.String>, java.util.Collection<java.lang.String>, java.util.List<java.lang.String>, WovenClass

    class WovenClassImpl
    extends java.lang.Object
    implements WovenClass, java.util.List<java.lang.String>
    • Constructor Summary

      Constructors 
      Constructor Description
      WovenClassImpl​(java.lang.String className, BundleWiring wiring, byte[] bytes)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) byte[] _getBytes()  
      void add​(int i, java.lang.String s)  
      boolean add​(java.lang.String s)  
      boolean addAll​(int i, java.util.Collection<? extends java.lang.String> collection)  
      boolean addAll​(java.util.Collection<? extends java.lang.String> collection)  
      private void checkImport​(java.lang.String s)  
      void clear()  
      (package private) void complete​(java.lang.Class definedClass, byte[] bytes, java.util.List<java.lang.String> imports)  
      (package private) void completeDefine​(java.lang.Class definedClass)  
      (package private) void completeImports​(java.util.List<java.lang.String> imports)  
      boolean contains​(java.lang.Object o)  
      boolean containsAll​(java.util.Collection<?> collection)  
      java.lang.String get​(int i)  
      BundleWiring getBundleWiring()
      Returns the bundle wiring whose class loader will define the woven class.
      byte[] getBytes()
      Returns the class file bytes to be used to define the named class.
      java.lang.String getClassName()
      Returns the fully qualified name of the class being woven.
      java.lang.Class<?> getDefinedClass()
      Returns the class defined by this woven class.
      java.util.List<java.lang.String> getDynamicImports()
      Returns the list of dynamic import package descriptions to add to the bundle wiring for this woven class.
      (package private) java.util.List<java.lang.String> getDynamicImportsInternal()  
      java.security.ProtectionDomain getProtectionDomain()
      Returns the protection domain to which the woven class will be assigned when it is defined.
      int getState()
      Returns the current state of this woven class.
      int indexOf​(java.lang.Object o)  
      boolean isEmpty()  
      boolean isWeavingComplete()
      Returns whether weaving is complete in this woven class.
      java.util.Iterator<java.lang.String> iterator()  
      int lastIndexOf​(java.lang.Object o)  
      java.util.ListIterator<java.lang.String> listIterator()  
      java.util.ListIterator<java.lang.String> listIterator​(int i)  
      java.lang.String remove​(int i)  
      boolean remove​(java.lang.Object o)  
      boolean removeAll​(java.util.Collection<?> collection)  
      boolean retainAll​(java.util.Collection<?> collection)  
      java.lang.String set​(int i, java.lang.String s)  
      void setBytes​(byte[] bytes)
      Set the class file bytes to be used to define the named class.
      void setState​(int state)  
      int size()  
      java.util.List<java.lang.String> subList​(int i, int i1)  
      java.lang.Object[] toArray()  
      <T> T[] toArray​(T[] ts)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        equals, hashCode, replaceAll, sort, spliterator
    • Field Detail

      • m_className

        private final java.lang.String m_className
      • m_bytes

        private byte[] m_bytes
      • m_imports

        private java.util.List<java.lang.String> m_imports
      • m_definedClass

        private java.lang.Class m_definedClass
      • m_isComplete

        private boolean m_isComplete
      • m_state

        private int m_state
    • Constructor Detail

      • WovenClassImpl

        WovenClassImpl​(java.lang.String className,
                       BundleWiring wiring,
                       byte[] bytes)
    • Method Detail

      • complete

        void complete​(java.lang.Class definedClass,
                      byte[] bytes,
                      java.util.List<java.lang.String> imports)
      • completeImports

        void completeImports​(java.util.List<java.lang.String> imports)
      • completeDefine

        void completeDefine​(java.lang.Class definedClass)
      • getBytes

        public byte[] getBytes()
        Description copied from interface: WovenClass
        Returns the class file bytes to be used to define the named class.

        While in the WovenClass.TRANSFORMING state, this method returns a reference to the class files byte array contained in this object. After leaving the WovenClass.TRANSFORMING state, this woven class can no longer be transformed and a copy of the class file byte array is returned.

        Specified by:
        getBytes in interface WovenClass
        Returns:
        The bytes to be used to define the named class.
      • setBytes

        public void setBytes​(byte[] bytes)
        Description copied from interface: WovenClass
        Set the class file bytes to be used to define the named class. This method must not be called outside invocations of the weave method by the framework.

        While in the WovenClass.TRANSFORMING state, this method replaces the reference to the array contained in this object with the specified array. After leaving the WovenClass.TRANSFORMING state, this woven class can no longer be transformed and this method will throw an IllegalStateException.

        Specified by:
        setBytes in interface WovenClass
        Parameters:
        bytes - The new classfile that will be used to define the named class. The specified array is retained by this object and the caller must not modify the specified array.
      • getDynamicImportsInternal

        java.util.List<java.lang.String> getDynamicImportsInternal()
      • getDynamicImports

        public java.util.List<java.lang.String> getDynamicImports()
        Description copied from interface: WovenClass
        Returns the list of dynamic import package descriptions to add to the bundle wiring for this woven class. Changes made to the returned list will be visible to later weaving hooks called with this object. The returned list must not be modified outside invocations of the weave method by the framework.

        After leaving the WovenClass.TRANSFORMING state, 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 requires PackagePermission[package,IMPORT].

        Specified by:
        getDynamicImports in interface WovenClass
        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 IllegalArgumentException if a malformed dynamic import package description is added.
        See Also:
        "Core Specification, Dynamic Import Package, for the syntax of a dynamic import package description."
      • getClassName

        public java.lang.String getClassName()
        Description copied from interface: WovenClass
        Returns the fully qualified name of the class being woven.
        Specified by:
        getClassName in interface WovenClass
        Returns:
        The fully qualified name of the class being woven.
      • getProtectionDomain

        public java.security.ProtectionDomain getProtectionDomain()
        Description copied from interface: WovenClass
        Returns the protection domain to which the woven class will be assigned when it is defined.
        Specified by:
        getProtectionDomain in interface WovenClass
        Returns:
        The protection domain to which the woven class will be assigned when it is defined, or null if no protection domain will be assigned.
      • getDefinedClass

        public java.lang.Class<?> getDefinedClass()
        Description copied from interface: WovenClass
        Returns the class defined by this woven class. During weaving, this method will return null. Once weaving is complete, this method will return the class object if this woven class was used to define the class.
        Specified by:
        getDefinedClass in interface WovenClass
        Returns:
        The class associated with this woven class, or null if weaving is not complete, the class definition failed or this woven class was not used to define the class.
      • getBundleWiring

        public BundleWiring getBundleWiring()
        Description copied from interface: WovenClass
        Returns the bundle wiring whose class loader will define the woven class.
        Specified by:
        getBundleWiring in interface WovenClass
        Returns:
        The bundle wiring whose class loader will define the woven class.
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<java.lang.String>
        Specified by:
        size in interface java.util.List<java.lang.String>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<java.lang.String>
        Specified by:
        isEmpty in interface java.util.List<java.lang.String>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<java.lang.String>
        Specified by:
        contains in interface java.util.List<java.lang.String>
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Specified by:
        iterator in interface java.util.Collection<java.lang.String>
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
        Specified by:
        iterator in interface java.util.List<java.lang.String>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<java.lang.String>
        Specified by:
        toArray in interface java.util.List<java.lang.String>
      • toArray

        public <T> T[] toArray​(T[] ts)
        Specified by:
        toArray in interface java.util.Collection<java.lang.String>
        Specified by:
        toArray in interface java.util.List<java.lang.String>
      • add

        public boolean add​(java.lang.String s)
        Specified by:
        add in interface java.util.Collection<java.lang.String>
        Specified by:
        add in interface java.util.List<java.lang.String>
      • checkImport

        private void checkImport​(java.lang.String s)
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<java.lang.String>
        Specified by:
        remove in interface java.util.List<java.lang.String>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> collection)
        Specified by:
        containsAll in interface java.util.Collection<java.lang.String>
        Specified by:
        containsAll in interface java.util.List<java.lang.String>
      • addAll

        public boolean addAll​(java.util.Collection<? extends java.lang.String> collection)
        Specified by:
        addAll in interface java.util.Collection<java.lang.String>
        Specified by:
        addAll in interface java.util.List<java.lang.String>
      • addAll

        public boolean addAll​(int i,
                              java.util.Collection<? extends java.lang.String> collection)
        Specified by:
        addAll in interface java.util.List<java.lang.String>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> collection)
        Specified by:
        removeAll in interface java.util.Collection<java.lang.String>
        Specified by:
        removeAll in interface java.util.List<java.lang.String>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> collection)
        Specified by:
        retainAll in interface java.util.Collection<java.lang.String>
        Specified by:
        retainAll in interface java.util.List<java.lang.String>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<java.lang.String>
        Specified by:
        clear in interface java.util.List<java.lang.String>
      • get

        public java.lang.String get​(int i)
        Specified by:
        get in interface java.util.List<java.lang.String>
      • set

        public java.lang.String set​(int i,
                                    java.lang.String s)
        Specified by:
        set in interface java.util.List<java.lang.String>
      • add

        public void add​(int i,
                        java.lang.String s)
        Specified by:
        add in interface java.util.List<java.lang.String>
      • remove

        public java.lang.String remove​(int i)
        Specified by:
        remove in interface java.util.List<java.lang.String>
      • indexOf

        public int indexOf​(java.lang.Object o)
        Specified by:
        indexOf in interface java.util.List<java.lang.String>
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object o)
        Specified by:
        lastIndexOf in interface java.util.List<java.lang.String>
      • listIterator

        public java.util.ListIterator<java.lang.String> listIterator()
        Specified by:
        listIterator in interface java.util.List<java.lang.String>
      • listIterator

        public java.util.ListIterator<java.lang.String> listIterator​(int i)
        Specified by:
        listIterator in interface java.util.List<java.lang.String>
      • subList

        public java.util.List<java.lang.String> subList​(int i,
                                                        int i1)
        Specified by:
        subList in interface java.util.List<java.lang.String>
      • _getBytes

        byte[] _getBytes()
      • setState

        public void setState​(int state)