Codota Logo
Enhancer$EnhancerFactoryData
Code IndexAdd Codota to your IDE (free)

How to use
Enhancer$EnhancerFactoryData
in
org.springframework.cglib.proxy

Best Java code snippets using org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData (Showing top 10 results out of 315)

  • Common ways to obtain Enhancer$EnhancerFactoryData
private void myMethod () {
Enhancer$EnhancerFactoryData e =
  • Codota IconClass generatedClass;Class[] primaryConstructorArgTypes;new EnhancerFactoryData(generatedClass, primaryConstructorArgTypes, classOnly)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

@Override
protected Object wrapCachedClass(Class klass) {
  Class[] argumentTypes = this.argumentTypes;
  if (argumentTypes == null) {
    argumentTypes = Constants.EMPTY_CLASS_ARRAY;
  }
  EnhancerFactoryData factoryData = new EnhancerFactoryData(klass, argumentTypes, classOnly);
  Field factoryDataField = null;
  try {
    // The subsequent dance is performed just once for each class,
    // so it does not matter much how fast it goes
    factoryDataField = klass.getField(FACTORY_DATA_FIELD);
    factoryDataField.set(null, factoryData);
    Field callbackFilterField = klass.getDeclaredField(CALLBACK_FILTER_FIELD);
    callbackFilterField.setAccessible(true);
    callbackFilterField.set(null, this.filter);
  }
  catch (NoSuchFieldException e) {
    throw new CodeGenerationException(e);
  }
  catch (IllegalAccessException e) {
    throw new CodeGenerationException(e);
  }
  return new WeakReference<EnhancerFactoryData>(factoryData);
}
origin: spring-projects/spring-framework

/**
 * Creates proxy instance for given argument types, and assigns the callbacks.
 * Ideally, for each proxy class, just one set of argument types should be used,
 * otherwise it would have to spend time on constructor lookup.
 * Technically, it is a re-implementation of {@link Enhancer#createUsingReflection(Class)},
 * with "cache {@link #setThreadCallbacks} and {@link #primaryConstructor}"
 * @param argumentTypes constructor argument types
 * @param arguments constructor arguments
 * @param callbacks callbacks to set for the new instance
 * @return newly created proxy
 * @see #createUsingReflection(Class)
 */
public Object newInstance(Class[] argumentTypes, Object[] arguments, Callback[] callbacks) {
  setThreadCallbacks(callbacks);
  try {
    // Explicit reference equality is added here just in case Arrays.equals does not have one
    if (primaryConstructorArgTypes == argumentTypes ||
        Arrays.equals(primaryConstructorArgTypes, argumentTypes)) {
      // If we have relevant Constructor instance at hand, just call it
      // This skips "get constructors" machinery
      return ReflectUtils.newInstance(primaryConstructor, arguments);
    }
    // Take a slow path if observing unexpected argument types
    return ReflectUtils.newInstance(generatedClass, argumentTypes, arguments);
  }
  finally {
    // clear thread callbacks to allow them to be gc'd
    setThreadCallbacks(null);
  }
}
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: org.springframework/spring-core

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: org.springframework/spring-core

@Override
protected Object wrapCachedClass(Class klass) {
  Class[] argumentTypes = this.argumentTypes;
  if (argumentTypes == null) {
    argumentTypes = Constants.EMPTY_CLASS_ARRAY;
  }
  EnhancerFactoryData factoryData = new EnhancerFactoryData(klass, argumentTypes, classOnly);
  Field factoryDataField = null;
  try {
    // The subsequent dance is performed just once for each class,
    // so it does not matter much how fast it goes
    factoryDataField = klass.getField(FACTORY_DATA_FIELD);
    factoryDataField.set(null, factoryData);
    Field callbackFilterField = klass.getDeclaredField(CALLBACK_FILTER_FIELD);
    callbackFilterField.setAccessible(true);
    callbackFilterField.set(null, this.filter);
  }
  catch (NoSuchFieldException e) {
    throw new CodeGenerationException(e);
  }
  catch (IllegalAccessException e) {
    throw new CodeGenerationException(e);
  }
  return new WeakReference<EnhancerFactoryData>(factoryData);
}
origin: org.springframework/spring-core

/**
 * Creates proxy instance for given argument types, and assigns the callbacks.
 * Ideally, for each proxy class, just one set of argument types should be used,
 * otherwise it would have to spend time on constructor lookup.
 * Technically, it is a re-implementation of {@link Enhancer#createUsingReflection(Class)},
 * with "cache {@link #setThreadCallbacks} and {@link #primaryConstructor}"
 * @param argumentTypes constructor argument types
 * @param arguments constructor arguments
 * @param callbacks callbacks to set for the new instance
 * @return newly created proxy
 * @see #createUsingReflection(Class)
 */
public Object newInstance(Class[] argumentTypes, Object[] arguments, Callback[] callbacks) {
  setThreadCallbacks(callbacks);
  try {
    // Explicit reference equality is added here just in case Arrays.equals does not have one
    if (primaryConstructorArgTypes == argumentTypes ||
        Arrays.equals(primaryConstructorArgTypes, argumentTypes)) {
      // If we have relevant Constructor instance at hand, just call it
      // This skips "get constructors" machinery
      return ReflectUtils.newInstance(primaryConstructor, arguments);
    }
    // Take a slow path if observing unexpected argument types
    return ReflectUtils.newInstance(generatedClass, argumentTypes, arguments);
  }
  finally {
    // clear thread callbacks to allow them to be gc'd
    setThreadCallbacks(null);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

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: apache/servicemix-bundles

@Override
protected Object wrapCachedClass(Class klass) {
  Class[] argumentTypes = this.argumentTypes;
  if (argumentTypes == null) {
    argumentTypes = Constants.EMPTY_CLASS_ARRAY;
  }
  EnhancerFactoryData factoryData = new EnhancerFactoryData(klass, argumentTypes, classOnly);
  Field factoryDataField = null;
  try {
    // The subsequent dance is performed just once for each class,
    // so it does not matter much how fast it goes
    factoryDataField = klass.getField(FACTORY_DATA_FIELD);
    factoryDataField.set(null, factoryData);
    Field callbackFilterField = klass.getDeclaredField(CALLBACK_FILTER_FIELD);
    callbackFilterField.setAccessible(true);
    callbackFilterField.set(null, this.filter);
  }
  catch (NoSuchFieldException e) {
    throw new CodeGenerationException(e);
  }
  catch (IllegalAccessException e) {
    throw new CodeGenerationException(e);
  }
  return new WeakReference<EnhancerFactoryData>(factoryData);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

@Override
protected Object wrapCachedClass(Class klass) {
  Class[] argumentTypes = this.argumentTypes;
  if (argumentTypes == null) {
    argumentTypes = Constants.EMPTY_CLASS_ARRAY;
  }
  EnhancerFactoryData factoryData = new EnhancerFactoryData(klass, argumentTypes, classOnly);
  Field factoryDataField = null;
  try {
    // The subsequent dance is performed just once for each class,
    // so it does not matter much how fast it goes
    factoryDataField = klass.getField(FACTORY_DATA_FIELD);
    factoryDataField.set(null, factoryData);
    Field callbackFilterField = klass.getDeclaredField(CALLBACK_FILTER_FIELD);
    callbackFilterField.setAccessible(true);
    callbackFilterField.set(null, this.filter);
  }
  catch (NoSuchFieldException e) {
    throw new CodeGenerationException(e);
  }
  catch (IllegalAccessException e) {
    throw new CodeGenerationException(e);
  }
  return new WeakReference<EnhancerFactoryData>(factoryData);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-core

/**
 * Creates proxy instance for given argument types, and assigns the callbacks.
 * Ideally, for each proxy class, just one set of argument types should be used,
 * otherwise it would have to spend time on constructor lookup.
 * Technically, it is a re-implementation of {@link Enhancer#createUsingReflection(Class)},
 * with "cache {@link #setThreadCallbacks} and {@link #primaryConstructor}"
 * @param argumentTypes constructor argument types
 * @param arguments constructor arguments
 * @param callbacks callbacks to set for the new instance
 * @return newly created proxy
 * @see #createUsingReflection(Class)
 */
public Object newInstance(Class[] argumentTypes, Object[] arguments, Callback[] callbacks) {
  setThreadCallbacks(callbacks);
  try {
    // Explicit reference equality is added here just in case Arrays.equals does not have one
    if (primaryConstructorArgTypes == argumentTypes ||
        Arrays.equals(primaryConstructorArgTypes, argumentTypes)) {
      // If we have relevant Constructor instance at hand, just call it
      // This skips "get constructors" machinery
      return ReflectUtils.newInstance(primaryConstructor, arguments);
    }
    // Take a slow path if observing unexpected argument types
    return ReflectUtils.newInstance(generatedClass, argumentTypes, arguments);
  }
  finally {
    // clear thread callbacks to allow them to be gc'd
    setThreadCallbacks(null);
  }
}
org.springframework.cglib.proxyEnhancer$EnhancerFactoryData

Javadoc

The idea of the class is to cache relevant java.lang.reflect instances so proxy-class can be instantiated faster that when using ReflectUtils#newInstance(Class,Class[],Object[])and Enhancer#setThreadCallbacks(Class,Callback[])

Most used methods

  • <init>
  • newInstance
    Creates proxy instance for given argument types, and assigns the callbacks. Ideally, for each proxy
  • setThreadCallbacks

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • requestLocationUpdates (LocationManager)
  • IOException (java.io)
    Signals that an I/O exception of some sort has occurred. This class is the general class of exceptio
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
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