Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2003 The Apache Software Foundation
  *
  *  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.mockito.cglib.core;

The GeneratorStrategyClassGenerator and producing a byte array containing the data for the generated Class. By providing your own strategy you may examine or modify the generated class before it is loaded. Typically this will be accomplished by subclassing DefaultGeneratorStrategy and overriding the appropriate protected method.

public interface GeneratorStrategy {
    
Generate the class.

Parameters:
cg a class generator on which you can call ClassGenerator.generateClass(org.mockito.asm.ClassVisitor)
Returns:
a byte array containing the bits of a valid Class
    byte[] generate(ClassGenerator cgthrows Exception;

    
The GeneratorStrategy in use does not currently, but may in the future, affect the caching of classes generated by AbstractClassGenerator, so this is a reminder that you should correctly implement equals and hashCode to avoid generating too many classes.
    boolean equals(Object o);
New to GrepCode? Check out our FAQ X