@Override public Class<?>[] getInterfaces() { return ClassUtils.toClassArray(this.publishedInterfaces); }
@Override public Class<?>[] getInterfaces() { return ClassUtils.toClassArray(this.interfaces); }
@Override public Class<?>[] getProxiedInterfaces() { return ClassUtils.toClassArray(this.interfaces); }
/** * Turn the specified validation hints into JSR-303 validation groups. * @since 5.1 */ private Class<?>[] asValidationGroups(Object... validationHints) { Set<Class<?>> groups = new LinkedHashSet<>(4); for (Object hint : validationHints) { if (hint instanceof Class) { groups.add((Class<?>) hint); } } return ClassUtils.toClassArray(groups); }
/** * Return all interfaces that the given class implements as an array, * including ones implemented by superclasses. * <p>If the class itself is an interface, it gets returned as sole interface. * @param clazz the class to analyze for interfaces * @param classLoader the ClassLoader that the interfaces need to be visible in * (may be {@code null} when accepting all declared interfaces) * @return all interfaces that the given object implements as an array */ public static Class<?>[] getAllInterfacesForClass(Class<?> clazz, @Nullable ClassLoader classLoader) { return toClassArray(getAllInterfacesForClassAsSet(clazz, classLoader)); }
private Session getCloseSuppressingSessionProxy(Session target) { List<Class<?>> classes = new ArrayList<>(3); classes.add(SessionProxy.class); if (target instanceof QueueSession) { classes.add(QueueSession.class); } if (target instanceof TopicSession) { classes.add(TopicSession.class); } return (Session) Proxy.newProxyInstance(SessionProxy.class.getClassLoader(), ClassUtils.toClassArray(classes), new CloseSuppressingSessionInvocationHandler(target)); } }
/** * Turn the specified validation hints into JSR-303 validation groups. * @since 5.1 */ private Class<?>[] asValidationGroups(Object... validationHints) { Set<Class<?>> groups = new LinkedHashSet<>(4); for (Object hint : validationHints) { if (hint instanceof Class) { groups.add((Class<?>) hint); } } return ClassUtils.toClassArray(groups); }
/** * Wrap the given Connection with a proxy that delegates every method call to it * but suppresses close calls. This is useful for allowing application code to * handle a special framework Connection just like an ordinary Connection from a * JMS ConnectionFactory. * @param target the original Connection to wrap * @return the wrapped Connection */ protected Connection getSharedConnectionProxy(Connection target) { List<Class<?>> classes = new ArrayList<>(3); classes.add(Connection.class); if (target instanceof QueueConnection) { classes.add(QueueConnection.class); } if (target instanceof TopicConnection) { classes.add(TopicConnection.class); } return (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(), ClassUtils.toClassArray(classes), new SharedConnectionInvocationHandler()); }
/** * Wrap the given Connection with a proxy that delegates every method call to it * but handles Session lookup in a transaction-aware fashion. * @param target the original Connection to wrap * @return the wrapped Connection */ protected Connection getTransactionAwareConnectionProxy(Connection target) { List<Class<?>> classes = new ArrayList<>(3); classes.add(Connection.class); if (target instanceof QueueConnection) { classes.add(QueueConnection.class); } if (target instanceof TopicConnection) { classes.add(TopicConnection.class); } return (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(), ClassUtils.toClassArray(classes), new TransactionAwareConnectionInvocationHandler(target)); }
/** * Wrap the given Session with a proxy that delegates every method call to it * but adapts close calls. This is useful for allowing application code to * handle a special framework Session just like an ordinary Session. * @param target the original Session to wrap * @param sessionList the List of cached Sessions that the given Session belongs to * @return the wrapped Session */ protected Session getCachedSessionProxy(Session target, LinkedList<Session> sessionList) { List<Class<?>> classes = new ArrayList<>(3); classes.add(SessionProxy.class); if (target instanceof QueueSession) { classes.add(QueueSession.class); } if (target instanceof TopicSession) { classes.add(TopicSession.class); } return (Session) Proxy.newProxyInstance(SessionProxy.class.getClassLoader(), ClassUtils.toClassArray(classes), new CachedSessionInvocationHandler(target, sessionList)); }
/** * Return all interfaces that the given class implements as an array, * including ones implemented by superclasses. * <p>If the class itself is an interface, it gets returned as sole interface. * @param clazz the class to analyze for interfaces * @param classLoader the ClassLoader that the interfaces need to be visible in * (may be {@code null} when accepting all declared interfaces) * @return all interfaces that the given object implements as an array */ public static Class<?>[] getAllInterfacesForClass(Class<?> clazz, @Nullable ClassLoader classLoader) { return toClassArray(getAllInterfacesForClassAsSet(clazz, classLoader)); }
ClassUtils.toClassArray(ifcs), new ManagedEntityManagerFactoryInvocationHandler(this));
return (EntityManager) Proxy.newProxyInstance( (cl != null ? cl : ExtendedEntityManagerCreator.class.getClassLoader()), ClassUtils.toClassArray(ifcs), new ExtendedEntityManagerInvocationHandler( rawEm, exceptionTranslator, jta, containerManaged, synchronizedWithTransaction));
return ClassUtils.toClassArray(configClasses);
private ShadowMatch getTargetShadowMatch(Method method, Class<?> targetClass) { Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass); if (targetMethod.getDeclaringClass().isInterface()) { // Try to build the most specific interface possible for inherited methods to be // considered for sub-interface matches as well, in particular for proxy classes. // Note: AspectJ is only going to take Method.getDeclaringClass() into account. Set<Class<?>> ifcs = ClassUtils.getAllInterfacesForClassAsSet(targetClass); if (ifcs.size() > 1) { try { Class<?> compositeInterface = ClassUtils.createCompositeInterface( ClassUtils.toClassArray(ifcs), targetClass.getClassLoader()); targetMethod = ClassUtils.getMostSpecificMethod(targetMethod, compositeInterface); } catch (IllegalArgumentException ex) { // Implemented interfaces probably expose conflicting method signatures... // Proceed with original target method. } } } return getShadowMatch(targetMethod, method); }
private void registerAnnotatedClasses(AnnotatedBeanDefinitionReader reader) { if (this.logger.isInfoEnabled()) { this.logger.info("Registering annotated classes: [" + StringUtils.collectionToCommaDelimitedString(this.annotatedClasses) + "]"); } reader.register(ClassUtils.toClassArray(this.annotatedClasses)); }
@Override protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { super.postProcessBeanFactory(beanFactory); if (!ObjectUtils.isEmpty(this.basePackages)) { this.scanner.scan(this.basePackages); } if (!this.annotatedClasses.isEmpty()) { this.reader.register(ClassUtils.toClassArray(this.annotatedClasses)); } }
@Override protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { super.postProcessBeanFactory(beanFactory); if (this.basePackages != null && this.basePackages.length > 0) { this.scanner.scan(this.basePackages); } if (!this.annotatedClasses.isEmpty()) { this.reader.register(ClassUtils.toClassArray(this.annotatedClasses)); } }
return ClassUtils.toClassArray(jaxb2Classes);
TestPropertySourceUtils.buildMergedTestPropertySources(testClass); MergedContextConfiguration mergedConfig = new MergedContextConfiguration(testClass, StringUtils.toStringArray(locations), ClassUtils.toClassArray(classes), ApplicationContextInitializerUtils.resolveInitializerClasses(configAttributesList), ActiveProfilesUtils.resolveActiveProfiles(testClass),