Codota Logo
org.springframework.cglib.proxy
Code IndexAdd Codota to your IDE (free)

How to use org.springframework.cglib.proxy

Best Java code snippets using org.springframework.cglib.proxy (Showing top 20 results out of 342)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

/**
 * Return the {@link org.springframework.cglib.reflect.FastClass} method index
 * for the method used by {@link #invokeSuper}. This index uniquely
 * identifies the method within the generated proxy, and therefore
 * can be useful to reference external metadata.
 * @see #getSuperName
 */
public int getSuperIndex() {
  init();
  return fastClassInfo.i2;
}
origin: spring-projects/spring-framework

/**
 * Generate a new class if necessary and return it without creating a new instance.
 * This ignores any callbacks that have been set.
 * To create a new instance you will have to use reflection, and methods
 * called during the constructor will not be intercepted. To avoid this problem,
 * use the multi-arg <code>create</code> method.
 * @see #create(Class[], Object[])
 */
public Class createClass() {
  classOnly = true;
  return (Class) createHelper();
}
origin: spring-projects/spring-framework

/**
 * Similar to {@link #registerCallbacks}, but suitable for use
 * when multiple threads will be creating instances of the generated class.
 * The thread-level callbacks will always override the static callbacks.
 * Static callbacks are never cleared.
 * @param generatedClass a class previously created by {@link Enhancer}
 * @param callbacks the array of callbacks to use when instances of the generated
 * class are created
 */
public static void registerStaticCallbacks(Class generatedClass, Callback[] callbacks) {
  setCallbacksHelper(generatedClass, callbacks, SET_STATIC_CALLBACKS_NAME);
}
origin: spring-projects/spring-framework

/**
 * Helper method to create an intercepted object.
 * For finer control over the generated instance, use a new instance of <code>Enhancer</code>
 * instead of this static method.
 * @param type class to extend or interface to implement
 * @param callback the callback to use for all methods
 */
public static Object create(Class type, Callback callback) {
  Enhancer e = new Enhancer();
  e.setSuperclass(type);
  e.setCallback(callback);
  return e.create();
}
origin: spring-projects/spring-framework

/**
 * Creates the CGLIB {@link Enhancer}. Subclasses may wish to override this to return a custom
 * {@link Enhancer} implementation.
 */
protected Enhancer createEnhancer() {
  return new Enhancer();
}
origin: spring-projects/spring-framework

protected Object createProxyClassAndInstance(Enhancer enhancer, Callback[] callbacks) {
  enhancer.setInterceptDuringConstruction(false);
  enhancer.setCallbacks(callbacks);
  return (this.constructorArgs != null && this.constructorArgTypes != null ?
      enhancer.create(this.constructorArgTypes, this.constructorArgs) :
      enhancer.create());
}
origin: spring-projects/spring-framework

/**
 * Uses enhancer to generate a subclass of superclass,
 * ensuring that callbacks are registered for the new subclass.
 */
private Class<?> createClass(Enhancer enhancer) {
  Class<?> subclass = enhancer.createClass();
  // Registering callbacks statically (as opposed to thread-local)
  // is critical for usage in an OSGi environment (SPR-5932)...
  Enhancer.registerStaticCallbacks(subclass, CALLBACKS);
  return subclass;
}
origin: spring-projects/spring-framework

/**
 * Set the single type of {@link Callback} to use.
 * This may be used instead of {@link #setCallback} when calling
 * {@link #createClass}, since it may not be possible to have
 * an array of actual callback instances.
 * @param callbackType the type of callback to use for all methods
 * @see #setCallbackTypes
 */
public void setCallbackType(Class callbackType) {
  setCallbackTypes(new Class[]{callbackType});
}
origin: spring-projects/spring-framework

/**
 * Set the single {@link Callback} to use.
 * Ignored if you use {@link #createClass}.
 * @param callback the callback to use for all methods
 * @see #setCallbacks
 */
public void setCallback(final Callback callback) {
  setCallbacks(new Callback[]{callback});
}
origin: spring-projects/spring-framework

/**
 * For internal use by {@link Enhancer} only; see the {@link org.springframework.cglib.reflect.FastMethod} class
 * for similar functionality.
 */
public static MethodProxy create(Class c1, Class c2, String desc, String name1, String name2) {
  MethodProxy proxy = new MethodProxy();
  proxy.sig1 = new Signature(name1, desc);
  proxy.sig2 = new Signature(name2, desc);
  proxy.createInfo = new CreateInfo(c1, c2);
  return proxy;
}
origin: spring-projects/spring-framework

protected Object nextInstance(Object instance) {
  EnhancerFactoryData data = (EnhancerFactoryData) instance;
  if (classOnly) {
    return data.generatedClass;
  }
  Class[] argumentTypes = this.argumentTypes;
  Object[] arguments = this.arguments;
  if (argumentTypes == null) {
    argumentTypes = Constants.EMPTY_CLASS_ARRAY;
    arguments = null;
  }
  return data.newInstance(argumentTypes, arguments, callbacks);
}
origin: spring-projects/spring-framework

public ClassLoader getClassLoader() {
  return Enhancer.this.getClassLoader();
}
origin: spring-projects/spring-framework

/**
 * Determine if a class was generated using <code>Enhancer</code>.
 * @param type any class
 * @return whether the class was generated  using <code>Enhancer</code>
 */
public static boolean isEnhanced(Class type) {
  try {
    getCallbacksSetter(type, SET_THREAD_CALLBACKS_NAME);
    return true;
  }
  catch (NoSuchMethodException e) {
    return false;
  }
}
origin: spring-projects/spring-framework

/**
 * Finds all of the methods that will be extended by an
 * Enhancer-generated class using the specified superclass and
 * interfaces. This can be useful in building a list of Callback
 * objects. The methods are added to the end of the given list.  Due
 * to the subclassing nature of the classes generated by Enhancer,
 * the methods are guaranteed to be non-static, non-final, and
 * non-private. Each method signature will only occur once, even if
 * it occurs in multiple classes.
 * @param superclass the class that will be extended, or null
 * @param interfaces the list of interfaces that will be implemented, or null
 * @param methods the list into which to copy the applicable methods
 */
public static void getMethods(Class superclass, Class[] interfaces, List methods) {
  getMethods(superclass, interfaces, methods, null, null);
}
origin: spring-projects/spring-framework

/**
 * This method should not be called in regular flow.
 * Technically speaking {@link #wrapCachedClass(Class)} uses {@link EnhancerFactoryData} as a cache value,
 * and the latter enables faster instantiation than plain old reflection lookup and invoke.
 * This method is left intact for backward compatibility reasons: just in case it was ever used.
 * @param type class to instantiate
 * @return newly created proxy instance
 * @throws Exception if something goes wrong
 */
protected Object firstInstance(Class type) throws Exception {
  if (classOnly) {
    return type;
  }
  else {
    return createUsingReflection(type);
  }
}
origin: spring-projects/spring-framework

/**
 * Helper method to create an intercepted object.
 * For finer control over the generated instance, use a new instance of <code>Enhancer</code>
 * instead of this static method.
 * @param superclass class to extend or interface to implement
 * @param interfaces array of interfaces to implement, or null
 * @param callback the callback to use for all methods
 */
public static Object create(Class superclass, Class interfaces[], Callback callback) {
  Enhancer e = new Enhancer();
  e.setSuperclass(superclass);
  e.setInterfaces(interfaces);
  e.setCallback(callback);
  return e.create();
}
origin: spring-projects/spring-framework

FastClass getSuperFastClass() {
  init();
  return fastClassInfo.f2;
}
origin: spring-projects/spring-framework

/**
 * Generate a new class if necessary and uses the specified
 * callbacks (if any) to create a new object instance.
 * Uses the no-arg constructor of the superclass.
 * @return a new instance
 */
public Object create() {
  classOnly = false;
  argumentTypes = null;
  return createHelper();
}
origin: spring-projects/spring-framework

private static void setThreadCallbacks(Class type, Callback[] callbacks) {
  setCallbacksHelper(type, callbacks, SET_THREAD_CALLBACKS_NAME);
}
origin: spring-projects/spring-framework

FastClass getFastClass() {
  init();
  return fastClassInfo.f1;
}
org.springframework.cglib.proxy

Most used classes

  • Enhancer
    Generates dynamic subclasses to enable method interception. This class started as a substitute for t
  • Factory
  • MethodProxy
    Classes generated by Enhancer pass this object to the registered MethodInterceptor objects when an i
  • Proxy
  • BridgeMethodResolver
  • CallbackGenerator,
  • CallbackInfo,
  • Enhancer$EnhancerFactoryData,
  • Enhancer$EnhancerKey,
  • InterfaceMaker,
  • MethodProxy$CreateInfo,
  • MethodProxy$FastClassInfo,
  • InvocationHandler
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now