Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.osgi.framework.hooks.weaving;
 
 import java.util.List;
 
A class being woven. This object represents a class being woven and is passed to each WeavingHook for possible modification. It allows access to the most recently transformed class file bytes and to any additional packages that should be added to the bundle as dynamic imports.

After weaving is complete, this object becomes effectively immutable.

Version:
$Id: c689a4c27dc39af1bf5f51338f1a8eaca1dddc1a $
NotThreadSafe:
Noimplement:
 
 public interface WovenClass {

Returns the class file bytes to be used to define the named class.

While weaving is not complete, this method returns a reference to the class files byte array contained in this object. After weaving is complete, this object becomes effectively immutable and a copy of the class file byte array is returned.

Returns:
The bytes to be used to define the named class.
Throws:
java.lang.SecurityException If the caller does not have AdminPermission[bundle,WEAVE] and the Java runtime environment supports permissions.
 
 	public byte[] getBytes();

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 weaving is not complete, this method replaces the reference to the array contained in this object with the specified array. After weaving is complete, this object becomes effectively immutable and this method will throw an java.lang.IllegalStateException.

Parameters:
newBytes 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.
Throws:
java.lang.NullPointerException If newBytes is null.
java.lang.IllegalStateException If weaving is complete.
java.lang.SecurityException If the caller does not have AdminPermission[bundle,WEAVE] and the Java runtime environment supports permissions.
 
 	public void setBytes(byte[] newBytes);

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 weaving is complete, this object becomes effectively immutable and the returned list will be unmodifiable.

If the Java runtime environment supports permissions, the caller must have AdminPermission[bundle,WEAVE] to modify the returned list.

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."
Returns whether weaving is complete in this woven class. Weaving is complete after the last weaving hook is called and the class is defined.

After weaving is complete, this object becomes effectively immutable.

Returns:
true weaving is complete, false otherwise.
	public boolean isWeavingComplete();

Returns the fully qualified name of the class being woven.

Returns:
The fully qualified name of the class being woven.
	public String getClassName();

Returns the protection domain to which the woven class will be assigned when it is defined.

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.
Returns the class associated with this woven class. When loading a class for the first time this method will return null until weaving is complete. Once weaving is complete, this method will return the class object.

Returns:
The class associated with this woven class, or null if weaving is not complete or the class definition failed.
	public Class< ? > getDefinedClass();

Returns the bundle wiring whose class loader will define the woven class.

Returns:
The bundle wiring whose class loader will define the woven class.
New to GrepCode? Check out our FAQ X