org.springframework.util.Assert.isAssignable()

Here are the examples of the java api org.springframework.util.Assert.isAssignable() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

59 Examples 7

19 Source : XsltView.java
with Apache License 2.0
from langtianya

/**
 * Specify the XSLT TransformerFactory clreplaced to use.
 * <p>The default constructor of the specified clreplaced will be called
 * to build the TransformerFactory for this view.
 */
public void setTransformerFactoryClreplaced(Clreplaced<?> transformerFactoryClreplaced) {
    replacedert.isreplacedignable(TransformerFactory.clreplaced, transformerFactoryClreplaced);
    this.transformerFactoryClreplaced = transformerFactoryClreplaced;
}

19 Source : ConfigurableJasperReportsView.java
with Apache License 2.0
from langtianya

/**
 * Set the {@code JRExporter} implementation {@code Clreplaced} to use. Throws
 * {@link IllegalArgumentException} if the {@code Clreplaced} doesn't implement
 * {@code JRExporter}. Required setting, as it does not have a default.
 */
public void setExporterClreplaced(Clreplaced<? extends net.sf.jasperreports.engine.JRExporter> exporterClreplaced) {
    replacedert.isreplacedignable(net.sf.jasperreports.engine.JRExporter.clreplaced, exporterClreplaced);
    this.exporterClreplaced = exporterClreplaced;
}

19 Source : ResourceAdapterFactoryBean.java
with Apache License 2.0
from langtianya

/**
 * Specify the target JCA ResourceAdapter as clreplaced, to be instantiated
 * with its default configuration.
 * <p>Alternatively, specify a pre-configured ResourceAdapter instance
 * through the "resourceAdapter" property.
 * @see #setResourceAdapter
 */
public void setResourceAdapterClreplaced(Clreplaced<?> resourceAdapterClreplaced) {
    replacedert.isreplacedignable(ResourceAdapter.clreplaced, resourceAdapterClreplaced);
    this.resourceAdapter = (ResourceAdapter) BeanUtils.instantiateClreplaced(resourceAdapterClreplaced);
}

19 Source : AbstractEntityManagerFactoryBean.java
with Apache License 2.0
from langtianya

/**
 * Specify the (potentially vendor-specific) EnreplacedyManagerFactory interface
 * that this EnreplacedyManagerFactory proxy is supposed to implement.
 * <p>The default will be taken from the specific JpaVendorAdapter, if any,
 * or set to the standard {@code javax.persistence.EnreplacedyManagerFactory}
 * interface else.
 * @see JpaVendorAdapter#getEnreplacedyManagerFactoryInterface()
 */
public void setEnreplacedyManagerFactoryInterface(Clreplaced<? extends EnreplacedyManagerFactory> emfInterface) {
    replacedert.isreplacedignable(EnreplacedyManagerFactory.clreplaced, emfInterface);
    this.enreplacedyManagerFactoryInterface = emfInterface;
}

19 Source : AbstractEntityManagerFactoryBean.java
with Apache License 2.0
from langtianya

/**
 * Set the PersistenceProvider implementation clreplaced to use for creating the
 * EnreplacedyManagerFactory. If not specified, the persistence provider will be
 * taken from the JpaVendorAdapter (if any) or retrieved through scanning
 * (as far as possible).
 * @see JpaVendorAdapter#getPersistenceProvider()
 * @see javax.persistence.spi.PersistenceProvider
 * @see javax.persistence.Persistence
 */
public void setPersistenceProviderClreplaced(Clreplaced<? extends PersistenceProvider> persistenceProviderClreplaced) {
    replacedert.isreplacedignable(PersistenceProvider.clreplaced, persistenceProviderClreplaced);
    this.persistenceProvider = BeanUtils.instantiateClreplaced(persistenceProviderClreplaced);
}

19 Source : AbstractEntityManagerFactoryBean.java
with Apache License 2.0
from langtianya

/**
 * Specify the (potentially vendor-specific) EnreplacedyManager interface
 * that this factory's EnreplacedyManagers are supposed to implement.
 * <p>The default will be taken from the specific JpaVendorAdapter, if any,
 * or set to the standard {@code javax.persistence.EnreplacedyManager}
 * interface else.
 * @see JpaVendorAdapter#getEnreplacedyManagerInterface()
 * @see EnreplacedyManagerFactoryInfo#getEnreplacedyManagerInterface()
 */
public void setEnreplacedyManagerInterface(Clreplaced<? extends EnreplacedyManager> emInterface) {
    replacedert.isreplacedignable(EnreplacedyManager.clreplaced, emInterface);
    this.enreplacedyManagerInterface = emInterface;
}

19 Source : TypeDescriptor.java
with Apache License 2.0
from langtianya

/**
 * Cast this {@link TypeDescriptor} to a superclreplaced or implemented interface
 * preserving annotations and nested type context.
 * @param superType the super type to cast to (can be {@code null})
 * @return a new TypeDescriptor for the up-cast type
 * @throws IllegalArgumentException if this type is not replacedignable to the super-type
 * @since 3.2
 */
public TypeDescriptor upcast(Clreplaced<?> superType) {
    if (superType == null) {
        return null;
    }
    replacedert.isreplacedignable(superType, getType());
    return new TypeDescriptor(this.resolvableType.as(superType), superType, this.annotations);
}

19 Source : SchedulerFactoryBean.java
with Apache License 2.0
from langtianya

/**
 * Set the Quartz SchedulerFactory implementation to use.
 * <p>Default is {@link StdSchedulerFactory}, reading in the standard
 * {@code quartz.properties} from {@code quartz.jar}.
 * To use custom Quartz properties, specify the "configLocation"
 * or "quartzProperties" bean property on this FactoryBean.
 * @see org.quartz.impl.StdSchedulerFactory
 * @see #setConfigLocation
 * @see #setQuartzProperties
 */
public void setSchedulerFactoryClreplaced(Clreplaced<? extends SchedulerFactory> schedulerFactoryClreplaced) {
    replacedert.isreplacedignable(SchedulerFactory.clreplaced, schedulerFactoryClreplaced);
    this.schedulerFactoryClreplaced = schedulerFactoryClreplaced;
}

19 Source : MongoNativeJavaDriverQueryExecutor.java
with Apache License 2.0
from krraghavan

private DBObject getDbObject(Object o) {
    replacedert.isreplacedignable(DBObject.clreplaced, o.getClreplaced(), "Expecting DBObject type");
    return (DBObject) o;
}

19 Source : NonReactiveMongoNativeJavaDriverQueryExecutor.java
with Apache License 2.0
from krraghavan

private Doreplacedent getDoreplacedent(Object o) {
    replacedert.isreplacedignable(Doreplacedent.clreplaced, o.getClreplaced(), "Expecting DBObject type");
    return (org.bson.Doreplacedent) o;
}

18 Source : DelegatingApplicationContextInitializer.java
with Apache License 2.0
from yuanmabiji

private ApplicationContextInitializer<?> instantiateInitializer(Clreplaced<?> contextClreplaced, Clreplaced<?> initializerClreplaced) {
    Clreplaced<?> requireContextClreplaced = GenericTypeResolver.resolveTypeArgument(initializerClreplaced, ApplicationContextInitializer.clreplaced);
    replacedert.isreplacedignable(requireContextClreplaced, contextClreplaced, String.format("Could not add context initializer [%s]" + " as its generic parameter [%s] is not replacedignable " + "from the type of application context used by this " + "context loader [%s]: ", initializerClreplaced.getName(), requireContextClreplaced.getName(), contextClreplaced.getName()));
    return (ApplicationContextInitializer<?>) BeanUtils.instantiateClreplaced(initializerClreplaced);
}

18 Source : DelegatingApplicationContextInitializer.java
with Apache License 2.0
from yuanmabiji

private Clreplaced<?> getInitializerClreplaced(String clreplacedName) throws LinkageError {
    try {
        Clreplaced<?> initializerClreplaced = ClreplacedUtils.forName(clreplacedName, ClreplacedUtils.getDefaultClreplacedLoader());
        replacedert.isreplacedignable(ApplicationContextInitializer.clreplaced, initializerClreplaced);
        return initializerClreplaced;
    } catch (ClreplacedNotFoundException ex) {
        throw new ApplicationContextException("Failed to load context initializer clreplaced [" + clreplacedName + "]", ex);
    }
}

18 Source : TypeDescriptor.java
with MIT License
from Vip-Augus

/**
 * Cast this {@link TypeDescriptor} to a superclreplaced or implemented interface
 * preserving annotations and nested type context.
 * @param superType the super type to cast to (can be {@code null})
 * @return a new TypeDescriptor for the up-cast type
 * @throws IllegalArgumentException if this type is not replacedignable to the super-type
 * @since 3.2
 */
@Nullable
public TypeDescriptor upcast(@Nullable Clreplaced<?> superType) {
    if (superType == null) {
        return null;
    }
    replacedert.isreplacedignable(superType, getType());
    return new TypeDescriptor(getResolvableType().as(superType), superType, getAnnotations());
}

18 Source : BeanUtils.java
with MIT License
from Vip-Augus

/**
 * Instantiate a clreplaced using its no-arg constructor and return the new instance
 * as the specified replacedignable type.
 * <p>Useful in cases where the type of the clreplaced to instantiate (clazz) is not
 * available, but the type desired (replacedignableTo) is known.
 * <p>Note that this method tries to set the constructor accessible if given a
 * non-accessible (that is, non-public) constructor.
 * @param clazz clreplaced to instantiate
 * @param replacedignableTo type that clazz must be replacedignableTo
 * @return the new instance
 * @throws BeanInstantiationException if the bean cannot be instantiated
 * @see Constructor#newInstance
 */
@SuppressWarnings("unchecked")
public static <T> T instantiateClreplaced(Clreplaced<?> clazz, Clreplaced<T> replacedignableTo) throws BeanInstantiationException {
    replacedert.isreplacedignable(replacedignableTo, clazz);
    return (T) instantiateClreplaced(clazz);
}

18 Source : BeanUtils.java
with Apache License 2.0
from SourceHot

/**
 * Instantiate a clreplaced using its no-arg constructor and return the new instance as the specified
 * replacedignable type.
 * <p>Useful in cases where the type of the clreplaced to instantiate (clazz) is not
 * available, but the type desired (replacedignableTo) is known.
 * <p>Note that this method tries to set the constructor accessible if given a
 * non-accessible (that is, non-public) constructor.
 *
 * @param clazz        clreplaced to instantiate
 * @param replacedignableTo type that clazz must be replacedignableTo
 *
 * @return the new instance
 *
 * @throws BeanInstantiationException if the bean cannot be instantiated
 * @see Constructor#newInstance
 */
@SuppressWarnings("unchecked")
public static <T> T instantiateClreplaced(Clreplaced<?> clazz, Clreplaced<T> replacedignableTo) throws BeanInstantiationException {
    replacedert.isreplacedignable(replacedignableTo, clazz);
    return (T) instantiateClreplaced(clazz);
}

18 Source : SharedEntityManagerBean.java
with Apache License 2.0
from langtianya

/**
 * Specify the EnreplacedyManager interface to expose.
 * <p>Default is the EnreplacedyManager interface as defined by the
 * EnreplacedyManagerFactoryInfo, if available. Else, the standard
 * {@code javax.persistence.EnreplacedyManager} interface will be used.
 * @see org.springframework.orm.jpa.EnreplacedyManagerFactoryInfo#getEnreplacedyManagerInterface()
 * @see javax.persistence.EnreplacedyManager
 */
public void setEnreplacedyManagerInterface(Clreplaced<? extends EnreplacedyManager> enreplacedyManagerInterface) {
    replacedert.notNull(enreplacedyManagerInterface, "'enreplacedyManagerInterface' must not be null");
    replacedert.isreplacedignable(EnreplacedyManager.clreplaced, enreplacedyManagerInterface);
    this.enreplacedyManagerInterface = enreplacedyManagerInterface;
}

18 Source : SpringPersistenceManagerProxyBean.java
with Apache License 2.0
from langtianya

/**
 * Specify the PersistenceManager interface to expose,
 * possibly including vendor extensions.
 * <p>Default is the standard {@code javax.jdo.PersistenceManager} interface.
 */
public void setPersistenceManagerInterface(Clreplaced<? extends PersistenceManager> persistenceManagerInterface) {
    this.persistenceManagerInterface = persistenceManagerInterface;
    replacedert.notNull(persistenceManagerInterface, "persistenceManagerInterface must not be null");
    replacedert.isreplacedignable(PersistenceManager.clreplaced, persistenceManagerInterface);
}

18 Source : BeanUtils.java
with Apache License 2.0
from langtianya

/**
 * Instantiate a clreplaced using its no-arg constructor and return the new instance
 * as the the specified replacedignable type.
 * <p>Useful in cases where
 * the type of the clreplaced to instantiate (clazz) is not available, but the type
 * desired (replacedignableTo) is known.
 * <p>As this method doesn't try to load clreplacedes by name, it should avoid
 * clreplaced-loading issues.
 * <p>Note that this method tries to set the constructor accessible
 * if given a non-accessible (that is, non-public) constructor.
 * @param clazz clreplaced to instantiate
 * @param replacedignableTo type that clazz must be replacedignableTo
 * @return the new instance
 * @throws BeanInstantiationException if the bean cannot be instantiated
 */
@SuppressWarnings("unchecked")
public static <T> T instantiateClreplaced(Clreplaced<?> clazz, Clreplaced<T> replacedignableTo) throws BeanInstantiationException {
    replacedert.isreplacedignable(replacedignableTo, clazz);
    return (T) instantiateClreplaced(clazz);
}

17 Source : CustomScopeConfigurer.java
with Apache License 2.0
from langtianya

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    if (this.scopes != null) {
        for (Map.Entry<String, Object> entry : this.scopes.entrySet()) {
            String scopeKey = entry.getKey();
            Object value = entry.getValue();
            if (value instanceof Scope) {
                beanFactory.registerScope(scopeKey, (Scope) value);
            } else if (value instanceof Clreplaced) {
                Clreplaced<?> scopeClreplaced = (Clreplaced<?>) value;
                replacedert.isreplacedignable(Scope.clreplaced, scopeClreplaced);
                beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClreplaced(scopeClreplaced));
            } else if (value instanceof String) {
                Clreplaced<?> scopeClreplaced = ClreplacedUtils.resolveClreplacedName((String) value, this.beanClreplacedLoader);
                replacedert.isreplacedignable(Scope.clreplaced, scopeClreplaced);
                beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClreplaced(scopeClreplaced));
            } else {
                throw new IllegalArgumentException("Mapped value [" + value + "] for scope key [" + scopeKey + "] is not an instance of required type [" + Scope.clreplaced.getName() + "] or a corresponding Clreplaced or String value indicating a Scope implementation");
            }
        }
    }
}

17 Source : SimpleSpringMemcached.java
with Apache License 2.0
from awspring

@Override
public void evict(Object key) {
    replacedert.notNull(key, "key parameter is mandatory");
    replacedert.isreplacedignable(String.clreplaced, key.getClreplaced());
    try {
        this.memcachedClientIF.delete((String) key).get();
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    } catch (ExecutionException e) {
        throw new IllegalArgumentException("Error evicting items" + key);
    }
}

17 Source : SimpleSpringMemcached.java
with Apache License 2.0
from awspring

@Override
public <T> T get(Object key, Clreplaced<T> type) {
    replacedert.notNull(key, "key parameter is mandatory");
    replacedert.isreplacedignable(String.clreplaced, key.getClreplaced());
    Object result = this.memcachedClientIF.get((String) key);
    if (result == null) {
        return null;
    }
    replacedert.isreplacedignable(type, result.getClreplaced());
    return type.cast(result);
}

17 Source : SimpleSpringMemcached.java
with Apache License 2.0
from awspring

@Override
public void put(Object key, Object value) {
    replacedert.notNull(key, "key parameter is mandatory");
    replacedert.isreplacedignable(String.clreplaced, key.getClreplaced());
    try {
        this.memcachedClientIF.set((String) key, this.expiration, value).get();
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    } catch (ExecutionException e) {
        throw new IllegalArgumentException("Error writing key" + key, e);
    }
}

17 Source : SimpleSpringMemcached.java
with Apache License 2.0
from awspring

@Override
public ValueWrapper get(Object key) {
    replacedert.notNull(key, "key parameter is mandatory");
    replacedert.isreplacedignable(String.clreplaced, key.getClreplaced());
    Object result = this.memcachedClientIF.get((String) key);
    return result != null ? new SimpleValueWrapper(result) : null;
}

17 Source : SimpleSpringMemcached.java
with Apache License 2.0
from awspring

/**
 * <b>IMPORTANT:</b> This operation is not atomic as the underlying implementation
 * (memcached) does not provide a way to do it.
 */
@Override
public ValueWrapper putIfAbsent(Object key, Object value) {
    replacedert.notNull(key, "key parameter is mandatory");
    replacedert.isreplacedignable(String.clreplaced, key.getClreplaced());
    ValueWrapper valueWrapper = get(key);
    if (valueWrapper == null) {
        try {
            this.memcachedClientIF.add((String) key, this.expiration, value).get();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        } catch (ExecutionException e) {
            throw new IllegalArgumentException("Error writing key" + key, e);
        }
        return null;
    } else {
        return valueWrapper;
    }
}

16 Source : FilterAnnotations.java
with Apache License 2.0
from yuanmabiji

@SuppressWarnings("unchecked")
private TypeFilter createTypeFilter(FilterType filterType, Clreplaced<?> filterClreplaced) {
    switch(filterType) {
        case ANNOTATION:
            replacedert.isreplacedignable(Annotation.clreplaced, filterClreplaced, "An error occurred while processing an ANNOTATION type filter: ");
            return new AnnotationTypeFilter((Clreplaced<Annotation>) filterClreplaced);
        case replacedIGNABLE_TYPE:
            return new replacedignableTypeFilter(filterClreplaced);
        case CUSTOM:
            replacedert.isreplacedignable(TypeFilter.clreplaced, filterClreplaced, "An error occurred while processing a CUSTOM type filter: ");
            return BeanUtils.instantiateClreplaced(filterClreplaced, TypeFilter.clreplaced);
    }
    throw new IllegalArgumentException("Filter type not supported with Clreplaced value: " + filterType);
}

16 Source : ContextLoader.java
with Apache License 2.0
from langtianya

@SuppressWarnings("unchecked")
private Clreplaced<ApplicationContextInitializer<ConfigurableApplicationContext>> loadInitializerClreplaced(String clreplacedName) {
    try {
        Clreplaced<?> clazz = ClreplacedUtils.forName(clreplacedName, ClreplacedUtils.getDefaultClreplacedLoader());
        replacedert.isreplacedignable(ApplicationContextInitializer.clreplaced, clazz);
        return (Clreplaced<ApplicationContextInitializer<ConfigurableApplicationContext>>) clazz;
    } catch (ClreplacedNotFoundException ex) {
        throw new ApplicationContextException("Failed to load context initializer clreplaced [" + clreplacedName + "]", ex);
    }
}

16 Source : MappingJackson2XmlHttpMessageConverter.java
with Apache License 2.0
from langtianya

/**
 * {@inheritDoc}
 * The {@code objectMapper} parameter must be a {@link XmlMapper} instance.
 */
@Override
public void setObjectMapper(ObjectMapper objectMapper) {
    replacedert.isreplacedignable(XmlMapper.clreplaced, objectMapper.getClreplaced());
    super.setObjectMapper(objectMapper);
}

15 Source : CustomScopeConfigurer.java
with MIT License
from Vip-Augus

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    if (this.scopes != null) {
        this.scopes.forEach((scopeKey, value) -> {
            if (value instanceof Scope) {
                beanFactory.registerScope(scopeKey, (Scope) value);
            } else if (value instanceof Clreplaced) {
                Clreplaced<?> scopeClreplaced = (Clreplaced<?>) value;
                replacedert.isreplacedignable(Scope.clreplaced, scopeClreplaced, "Invalid scope clreplaced");
                beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClreplaced(scopeClreplaced));
            } else if (value instanceof String) {
                Clreplaced<?> scopeClreplaced = ClreplacedUtils.resolveClreplacedName((String) value, this.beanClreplacedLoader);
                replacedert.isreplacedignable(Scope.clreplaced, scopeClreplaced, "Invalid scope clreplaced");
                beanFactory.registerScope(scopeKey, (Scope) BeanUtils.instantiateClreplaced(scopeClreplaced));
            } else {
                throw new IllegalArgumentException("Mapped value [" + value + "] for scope key [" + scopeKey + "] is not an instance of required type [" + Scope.clreplaced.getName() + "] or a corresponding Clreplaced or String value indicating a Scope implementation");
            }
        });
    }
}

14 Source : TypeMappedAnnotation.java
with MIT License
from Vip-Augus

@Override
@SuppressWarnings("unchecked")
public <T extends Annotation> MergedAnnotation<T>[] getAnnotationArray(String attributeName, Clreplaced<T> type) throws NoSuchElementException {
    int attributeIndex = getAttributeIndex(attributeName, true);
    Method attribute = this.mapping.getAttributes().get(attributeIndex);
    Clreplaced<?> componentType = attribute.getReturnType().getComponentType();
    replacedert.notNull(type, "Type must not be null");
    replacedert.notNull(componentType, () -> "Attribute " + attributeName + " is not an array");
    replacedert.isreplacedignable(type, componentType, () -> "Attribute " + attributeName + " component type mismatch:");
    return (MergedAnnotation<T>[]) getRequiredValue(attributeIndex, attributeName);
}

14 Source : TypeMappedAnnotation.java
with MIT License
from Vip-Augus

@Override
@SuppressWarnings("unchecked")
public <T extends Annotation> MergedAnnotation<T> getAnnotation(String attributeName, Clreplaced<T> type) throws NoSuchElementException {
    int attributeIndex = getAttributeIndex(attributeName, true);
    Method attribute = this.mapping.getAttributes().get(attributeIndex);
    replacedert.notNull(type, "Type must not be null");
    replacedert.isreplacedignable(type, attribute.getReturnType(), () -> "Attribute " + attributeName + " type mismatch:");
    return (MergedAnnotation<T>) getRequiredValue(attributeIndex, attributeName);
}

14 Source : SpringApplication.java
with Apache License 2.0
from spring-io

@SuppressWarnings("unchecked")
private <T> List<T> createSpringFactoriesInstances(Clreplaced<T> type, Clreplaced<?>[] parameterTypes, ClreplacedLoader clreplacedLoader, Object[] args, Set<String> names) {
    List<T> instances = new ArrayList<>(names.size());
    for (String name : names) {
        try {
            Clreplaced<?> instanceClreplaced = ClreplacedUtils.forName(name, clreplacedLoader);
            replacedert.isreplacedignable(type, instanceClreplaced);
            Constructor<?> constructor = instanceClreplaced.getDeclaredConstructor(parameterTypes);
            T instance = (T) BeanUtils.instantiateClreplaced(constructor, args);
            instances.add(instance);
        } catch (Throwable ex) {
            throw new IllegalArgumentException("Cannot instantiate " + type + " : " + name, ex);
        }
    }
    return instances;
}

14 Source : ParserStrategyUtils.java
with Apache License 2.0
from SourceHot

/**
 * Instantiate a clreplaced using an appropriate constructor and return the new
 * instance as the specified replacedignable type. The returned instance will
 * have {@link BeanClreplacedLoaderAware}, {@link BeanFactoryAware},
 * {@link EnvironmentAware}, and {@link ResourceLoaderAware} contracts
 * invoked if they are implemented by the given object.
 * @since 5.2
 */
@SuppressWarnings("unchecked")
static <T> T instantiateClreplaced(Clreplaced<?> clazz, Clreplaced<T> replacedignableTo, Environment environment, ResourceLoader resourceLoader, BeanDefinitionRegistry registry) {
    replacedert.notNull(clazz, "Clreplaced must not be null");
    replacedert.isreplacedignable(replacedignableTo, clazz);
    if (clazz.isInterface()) {
        throw new BeanInstantiationException(clazz, "Specified clreplaced is an interface");
    }
    ClreplacedLoader clreplacedLoader = (registry instanceof ConfigurableBeanFactory ? ((ConfigurableBeanFactory) registry).getBeanClreplacedLoader() : resourceLoader.getClreplacedLoader());
    T instance = (T) createInstance(clazz, environment, resourceLoader, registry, clreplacedLoader);
    ParserStrategyUtils.invokeAwareMethods(instance, environment, resourceLoader, registry, clreplacedLoader);
    return instance;
}

14 Source : HttpEntityMethodProcessor.java
with Apache License 2.0
from langtianya

private Type getHttpEnreplacedyType(MethodParameter parameter) {
    replacedert.isreplacedignable(HttpEnreplacedy.clreplaced, parameter.getParameterType());
    Type parameterType = parameter.getGenericParameterType();
    if (parameterType instanceof ParameterizedType) {
        ParameterizedType type = (ParameterizedType) parameterType;
        if (type.getActualTypeArguments().length != 1) {
            throw new IllegalArgumentException("Expected single generic parameter on '" + parameter.getParameterName() + "' in method " + parameter.getMethod());
        }
        return type.getActualTypeArguments()[0];
    } else if (parameterType instanceof Clreplaced) {
        return Object.clreplaced;
    }
    throw new IllegalArgumentException("HttpEnreplacedy parameter '" + parameter.getParameterName() + "' in method " + parameter.getMethod() + " is not parameterized");
}

14 Source : HandlerMethodInvoker.java
with Apache License 2.0
from langtianya

private Clreplaced<?> getHttpEnreplacedyType(MethodParameter methodParam) {
    replacedert.isreplacedignable(HttpEnreplacedy.clreplaced, methodParam.getParameterType());
    ParameterizedType type = (ParameterizedType) methodParam.getGenericParameterType();
    if (type.getActualTypeArguments().length == 1) {
        Type typeArgument = type.getActualTypeArguments()[0];
        if (typeArgument instanceof Clreplaced) {
            return (Clreplaced<?>) typeArgument;
        } else if (typeArgument instanceof GenericArrayType) {
            Type componentType = ((GenericArrayType) typeArgument).getGenericComponentType();
            if (componentType instanceof Clreplaced) {
                // Surely, there should be a nicer way to do this
                Object array = Array.newInstance((Clreplaced<?>) componentType, 0);
                return array.getClreplaced();
            }
        }
    }
    throw new IllegalArgumentException("HttpEnreplacedy parameter (" + methodParam.getParameterName() + ") is not parameterized");
}

14 Source : MongoNativeJavaDriverQueryExecutor.java
with Apache License 2.0
from krraghavan

@SuppressWarnings({ "ConstantConditions", "unchecked" })
private /*
   * Called when results are not paged or if paged, the return is to a list type.
   */
Object getNonPageResults(QueryProvider<Pageable> queryProvider, Cursor cursor) {
    Clreplaced returnClreplaced = queryProvider.getMethodReturnType();
    boolean isCollectionTypeReturn = Iterable.clreplaced.isreplacedignableFrom(returnClreplaced);
    final Clreplaced outputClreplaced = queryProvider.getOutputClreplaced();
    replacedert.isTrue(!isCollectionTypeReturn || isCollectionTypeReturn && List.clreplaced.isreplacedignableFrom(returnClreplaced), "Only list return type is supported. " + returnClreplaced.getName() + " is not replacedignable to list");
    String resultKey = queryProvider.getQueryResultKey();
    if (BeanUtils.isSimpleValueType(outputClreplaced)) {
        // either primitives/String or list of such objects.
        if (isCollectionTypeReturn) {
            List retval = new ArrayList<>();
            while (cursor.hasNext()) {
                cursor.forEachRemaining(d -> retval.add(getValueFromDbObject(resultKey, d)));
            }
            return retval;
        } else {
            if (cursor.hasNext()) {
                DBObject next = cursor.next();
                return getValueFromDbObject(resultKey, next);
            }
        }
    } else {
        // deserialize into complex object.  Single of list of complex objects
        if (isCollectionTypeReturn) {
            List retval = new ArrayList<>();
            cursor.forEachRemaining(d -> {
                // resultKey would typically be empty for paged results.  But if the
                // query projects other values, the resultKey provides a way to extract
                // the results piece
                Object o = StringUtils.isNotEmpty(resultKey) ? d.get(resultKey) : d;
                // If the query has a pageable in it the results would be returned as a DBObject
                // but the actual results are in the "results" key.  In this case we're not returning
                // a page but a list so we'll just throw away the totals
                DBObject dbObject = getDbObject(o);
                if (queryProvider.isPageable()) {
                    // even though we're not returning a Page, the query itself could involve a Pageable.
                    // in this case we'll throw away the totalResultSetCount from the returned results.
                    Object results = dbObject.get(RESULTS);
                    replacedert.isreplacedignable(DBObject.clreplaced, results.getClreplaced(), "Expecting DBObject type");
                    replacedert.isreplacedignable(List.clreplaced, results.getClreplaced(), "Expecting a list of results");
                    extractDeserializedListFromResults(outputClreplaced, retval, (List) results);
                    replacedert.isTrue(!cursor.hasNext(), "For pageable type we only expect one record");
                } else {
                    // returning a collection for non-paged complex objects.
                    retval.add(deserialize(outputClreplaced, dbObject));
                }
            });
            return retval;
        } else {
            DBObject next = cursor.next();
            DBObject d = StringUtils.isNotEmpty(resultKey) ? (DBObject) next.get(resultKey) : next;
            replacedert.isTrue(!cursor.hasNext(), "Return type was for a single object but query returned multiple records");
            return deserialize(outputClreplaced, d);
        }
    }
    return null;
}

14 Source : AbstractCondition.java
with Apache License 2.0
from krraghavan

protected Object getParameterByIndex(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
    replacedert.isreplacedignable(AggregateQueryMethodConditionContext.clreplaced, conditionContext.getClreplaced());
    AggregateQueryMethodConditionContext ctx = (AggregateQueryMethodConditionContext) conditionContext;
    List<Object> parameters = ctx.getParameterValues();
    int parameterIndex = getParameterIndex(annotatedTypeMetadata);
    int paramCount = parameters.size();
    if (parameterIndex < paramCount) {
        return parameters.get(parameterIndex);
    }
    throw new IllegalArgumentException("Argument index " + parameterIndex + " out of bounds, max count: " + paramCount);
}

14 Source : OsgiPropertyEditorRegistrar.java
with Apache License 2.0
from eclipse

@SuppressWarnings("unchecked")
private void createEditors(Properties configuration) {
    boolean trace = log.isTraceEnabled();
    // load properties using this clreplaced clreplaced loader
    ClreplacedLoader clreplacedLoader = getClreplaced().getClreplacedLoader();
    for (Map.Entry<Object, Object> entry : configuration.entrySet()) {
        // key represents type
        Clreplaced<?> key;
        // value represents property editor
        Clreplaced<?> editorClreplaced;
        try {
            key = clreplacedLoader.loadClreplaced((String) entry.getKey());
            editorClreplaced = clreplacedLoader.loadClreplaced((String) entry.getValue());
        } catch (ClreplacedNotFoundException ex) {
            throw (RuntimeException) new IllegalArgumentException("Cannot load clreplaced").initCause(ex);
        }
        replacedert.isreplacedignable(PropertyEditor.clreplaced, editorClreplaced);
        if (trace)
            log.trace("Adding property editor[" + editorClreplaced + "] for type[" + key + "]");
        editors.put(key, (Clreplaced<? extends PropertyEditor>) editorClreplaced);
    }
}

13 Source : HttpEntityMethodProcessor.java
with MIT License
from Vip-Augus

@Nullable
private Type getHttpEnreplacedyType(MethodParameter parameter) {
    replacedert.isreplacedignable(HttpEnreplacedy.clreplaced, parameter.getParameterType());
    Type parameterType = parameter.getGenericParameterType();
    if (parameterType instanceof ParameterizedType) {
        ParameterizedType type = (ParameterizedType) parameterType;
        if (type.getActualTypeArguments().length != 1) {
            throw new IllegalArgumentException("Expected single generic parameter on '" + parameter.getParameterName() + "' in method " + parameter.getMethod());
        }
        return type.getActualTypeArguments()[0];
    } else if (parameterType instanceof Clreplaced) {
        return Object.clreplaced;
    } else {
        return null;
    }
}

13 Source : MongoNativeJavaDriverQueryExecutor.java
with Apache License 2.0
from krraghavan

@SuppressWarnings({ "ConstantConditions", "unchecked" })
private Object getPageableResults(QueryProvider<Pageable> queryProvider, Cursor cursor) {
    Clreplaced returnClreplaced = queryProvider.getMethodReturnType();
    boolean isCollectionTypeReturn = Iterable.clreplaced.isreplacedignableFrom(returnClreplaced);
    final Clreplaced outputClreplaced = queryProvider.getOutputClreplaced();
    replacedert.isTrue(!isCollectionTypeReturn || isCollectionTypeReturn && Page.clreplaced.isreplacedignableFrom(returnClreplaced), "Only page return type is supported. " + returnClreplaced.getName() + " is not replacedignable to page");
    String resultKey = queryProvider.getQueryResultKey();
    // we're returning a page full of data with a Pageable argument.  The query always returns
    // a single object with "results" and "totalResultSetCount".  We just package that in a
    // Page and return.
    Pageable pageable = queryProvider.getPageable();
    if (BeanUtils.isSimpleValueType(outputClreplaced)) {
        // either primitives/String or list of such objects.
        List pageContents = new ArrayList<>();
        Page retval = new PageImpl(new ArrayList(), pageable, 0);
        // expect only one object.
        if (cursor.hasNext()) {
            DBObject dbObject = cursor.next();
            Object results = dbObject.get(RESULTS);
            if (results == null) {
                return null;
            }
            replacedert.isreplacedignable(DBObject.clreplaced, results.getClreplaced(), "Expecting DBObject type");
            replacedert.isreplacedignable(List.clreplaced, results.getClreplaced(), "Expecting a list of results");
            extractDeserializedListFromResults(outputClreplaced, pageContents, (List) results);
            retval = new PageImpl(pageContents, pageable, (int) dbObject.get("totalResultSetCount"));
        }
        replacedert.isTrue(!cursor.hasNext(), "Expecting only one record in paged query");
        return retval;
    } else {
        // deserialize into complex object
        final Object[] returnValue = new Object[1];
        if (isCollectionTypeReturn) {
            List pageContents = new ArrayList<>();
            cursor.forEachRemaining(d -> {
                Object o = StringUtils.isNotEmpty(resultKey) ? d.get(resultKey) : d;
                // If the query has a pageable in it the results would be returned as a DBObject
                // but the actual results are in the "results" key.  In this case we're not returning
                // a page but a list so we'll just throw away the totals
                DBObject dbObject = getDbObject(o);
                Object results = dbObject.get(RESULTS);
                replacedert.isreplacedignable(DBObject.clreplaced, results.getClreplaced(), "Expecting DBObject type");
                replacedert.isreplacedignable(List.clreplaced, results.getClreplaced(), "Expecting a list of results");
                extractDeserializedListFromResults(outputClreplaced, pageContents, (List) results);
                returnValue[0] = new PageImpl(pageContents, pageable, (int) dbObject.get("totalResultSetCount"));
                replacedert.isTrue(!cursor.hasNext(), "For pageable type we only expect one record");
            });
            return returnValue[0];
        }
    }
    throw new IllegalStateException("Unexpected exit from block");
}

13 Source : WxXmlMessageConverter.java
with Apache License 2.0
from FastBootWeixin

@Override
protected Object readFromSource(Clreplaced<?> clazz, HttpHeaders headers, Source source) throws IOException {
    replacedert.isreplacedignable(WxRequest.Body.clreplaced, clazz, "错误的使用了消息转化器");
    WxRequest wxRequest = WxWebUtils.getWxRequestFromRequest();
    WxRequest.Body body = (WxRequest.Body) super.readFromSource(clazz, headers, source);
    if (!wxRequest.isEncrypted()) {
        return body;
    }
    if (StringUtils.isEmpty(body.getEncrypt()) && !StringUtils.isEmpty(body.getFromUserName())) {
        return body;
    }
    String decryptedMessage = wxXmlCryptoService.decrypt(wxRequest, body.getEncrypt());
    return super.readFromSource(clazz, headers, new StreamSource(new ByteArrayInputStream(decryptedMessage.getBytes(StandardCharsets.UTF_8))));
}

13 Source : OsgiServiceFactoryBean.java
with Apache License 2.0
from eclipse

public void afterPropertiesSet() throws Exception {
    replacedert.notNull(bundleContext, "required property 'bundleContext' has not been set");
    hasNamedBean = StringUtils.hasText(targetBeanName);
    replacedert.isTrue(hasNamedBean || target != null, "Either 'targetBeanName' or 'target' properties have to be set.");
    // if we have a name, we need a bean factory
    if (hasNamedBean) {
        replacedert.notNull(beanFactory, "Required property 'beanFactory' has not been set.");
    }
    // initialize bean only when dealing with singletons and named beans
    if (hasNamedBean) {
        replacedert.isTrue(beanFactory.containsBean(targetBeanName), "Cannot locate bean named '" + targetBeanName + "' inside the running bean factory.");
        if (beanFactory.isSingleton(targetBeanName)) {
            if (beanFactory instanceof ConfigurableListableBeanFactory) {
                ConfigurableListableBeanFactory clbf = (ConfigurableListableBeanFactory) beanFactory;
                BeanDefinition definition = clbf.getBeanDefinition(targetBeanName);
                if (!definition.isLazyInit()) {
                    target = beanFactory.getBean(targetBeanName);
                    targetClreplaced = target.getClreplaced();
                }
            }
        }
        if (targetClreplaced == null) {
            // lazily get the target clreplaced
            targetClreplaced = beanFactory.getType(targetBeanName);
        }
        // when running inside a container, add the dependency between this bean and the target one
        addBeanFactoryDependency();
    } else {
        targetClreplaced = target.getClreplaced();
    }
    if (propertiesResolver == null) {
        propertiesResolver = new BeanNameServicePropertiesResolver();
        ((BeanNameServicePropertiesResolver) propertiesResolver).setBundleContext(bundleContext);
    }
    // sanity check
    if (interfaces == null) {
        if (DefaultInterfaceDetector.DISABLED.equals(interfaceDetector))
            throw new IllegalArgumentException("No service interface(s) specified and auto-export discovery disabled; change at least one of these properties.");
        interfaces = new Clreplaced[0];
    } else // check visibility type
    {
        if (!ServiceFactory.clreplaced.isreplacedignableFrom(targetClreplaced)) {
            for (int interfaceIndex = 0; interfaceIndex < interfaces.length; interfaceIndex++) {
                Clreplaced<?> intf = interfaces[interfaceIndex];
                replacedert.isreplacedignable(intf, targetClreplaced, "Exported service object does not implement the given interface: ");
            }
        }
    }
    // check service properties listener
    if (serviceProperties instanceof ServicePropertiesListenerManager) {
        propertiesListener = new PropertiesMonitor();
        ((ServicePropertiesListenerManager) serviceProperties).addListener(propertiesListener);
    }
    boolean shouldRegisterAtStartup;
    synchronized (lock) {
        shouldRegisterAtStartup = registerAtStartup;
    }
    resolver = new LazyTargetResolver(target, beanFactory, targetBeanName, cacheTarget, getNotifier(), getLazyListeners());
    if (shouldRegisterAtStartup) {
        registerService();
    }
}

12 Source : FlowParser.java
with Apache License 2.0
from zhongxunking

// 解析节点决策器
private static FlowExecutor.NodeExecutor.NodeDeciderExecutor parseNodeDecider(Method nodeDeciderMethod, ProcessorExecutor processorExecutor) {
    // 校验方法类型
    replacedert.isTrue(Modifier.isPublic(nodeDeciderMethod.getModifiers()), String.format("节点决策器[%s]必须是public类型", nodeDeciderMethod));
    // 判断+校验入参类型,可以存在的入参类型:()、(FlowContext)、(T)、(T, FlowContext)————T表示能被处理器返回结果赋值的类型
    FlowExecutor.NodeExecutor.NodeDeciderExecutor.ParameterType parameterType;
    Clreplaced[] parameterTypes = nodeDeciderMethod.getParameterTypes();
    if (parameterTypes.length == 0) {
        // 入参类型:()
        parameterType = FlowExecutor.NodeExecutor.NodeDeciderExecutor.ParameterType.NONE;
    } else {
        replacedert.isTrue(AnnotatedElementUtils.findMergedAnnotation(nodeDeciderMethod, EndNode.clreplaced) == null, String.format("结束节点的决策器[%s]的入参类型必须为()", nodeDeciderMethod));
        if (parameterTypes.length == 1) {
            if (parameterTypes[0] == FlowContext.clreplaced) {
                // 入参类型:(FlowContext)
                parameterType = FlowExecutor.NodeExecutor.NodeDeciderExecutor.ParameterType.ONLY_FLOW_CONTEXT;
            } else {
                // 入参类型:(T)
                replacedert.isTrue(processorExecutor != null, String.format("节点决策器[%s]不能有非FlowContext入参,因为这个节点没有处理器", nodeDeciderMethod));
                replacedert.isreplacedignable(parameterTypes[0], processorExecutor.getReturnType(), String.format("节点决策器[%s]的入参类型必须能被其处理器返回类型赋值", nodeDeciderMethod));
                parameterType = FlowExecutor.NodeExecutor.NodeDeciderExecutor.ParameterType.ONLY_PROCESS_RESULT;
            }
        } else if (parameterTypes.length == 2) {
            // 入参类型:(T, FlowContext)
            replacedert.isTrue(processorExecutor != null, String.format("节点决策器[%s]不能有非FlowContext入参,因为这个节点没有处理器", nodeDeciderMethod));
            replacedert.isreplacedignable(parameterTypes[0], processorExecutor.getReturnType(), String.format("节点决策器[%s]的第一个入参类型必须能被其处理器返回类型赋值", nodeDeciderMethod));
            replacedert.isTrue(parameterTypes[1] == FlowContext.clreplaced, String.format("节点决策器[%s]的第二个入参类型必须是FlowContext", nodeDeciderMethod));
            parameterType = FlowExecutor.NodeExecutor.NodeDeciderExecutor.ParameterType.PROCESS_RESULT_AND_FLOW_CONTEXT;
        } else {
            throw new IllegalArgumentException(String.format("节点决策器[%s]的入参类型必须为:()、(FlowContext)、(T)、(T, FlowContext)————T表示能被处理器返回结果赋值的类型", nodeDeciderMethod));
        }
    }
    // 校验返回类型
    if (AnnotatedElementUtils.findMergedAnnotation(nodeDeciderMethod, EndNode.clreplaced) == null) {
        replacedert.isTrue(nodeDeciderMethod.getReturnType() == String.clreplaced, String.format("节点决策器[%s]的返回类型必须是String", nodeDeciderMethod));
    } else {
        replacedert.isTrue(nodeDeciderMethod.getReturnType() == void.clreplaced, String.format("结束节点(@EndNode)的决策器[%s]的返回类型必须是void", nodeDeciderMethod));
    }
    return new FlowExecutor.NodeExecutor.NodeDeciderExecutor(parameterType, nodeDeciderMethod);
}

12 Source : ComponentScanAnnotationParser.java
with Apache License 2.0
from SourceHot

private List<TypeFilter> typeFiltersFor(AnnotationAttributes filterAttributes) {
    List<TypeFilter> typeFilters = new ArrayList<>();
    FilterType filterType = filterAttributes.getEnum("type");
    for (Clreplaced<?> filterClreplaced : filterAttributes.getClreplacedArray("clreplacedes")) {
        switch(filterType) {
            case ANNOTATION:
                replacedert.isreplacedignable(Annotation.clreplaced, filterClreplaced, "@ComponentScan ANNOTATION type filter requires an annotation type");
                @SuppressWarnings("unchecked")
                Clreplaced<Annotation> annotationType = (Clreplaced<Annotation>) filterClreplaced;
                typeFilters.add(new AnnotationTypeFilter(annotationType));
                break;
            case replacedIGNABLE_TYPE:
                typeFilters.add(new replacedignableTypeFilter(filterClreplaced));
                break;
            case CUSTOM:
                replacedert.isreplacedignable(TypeFilter.clreplaced, filterClreplaced, "@ComponentScan CUSTOM type filter requires a TypeFilter implementation");
                TypeFilter filter = ParserStrategyUtils.instantiateClreplaced(filterClreplaced, TypeFilter.clreplaced, this.environment, this.resourceLoader, this.registry);
                typeFilters.add(filter);
                break;
            default:
                throw new IllegalArgumentException("Filter type not supported with Clreplaced value: " + filterType);
        }
    }
    for (String expression : filterAttributes.getStringArray("pattern")) {
        switch(filterType) {
            case ASPECTJ:
                typeFilters.add(new AspectJTypeFilter(expression, this.resourceLoader.getClreplacedLoader()));
                break;
            case REGEX:
                typeFilters.add(new RegexPatternTypeFilter(Pattern.compile(expression)));
                break;
            default:
                throw new IllegalArgumentException("Filter type not supported with String pattern: " + filterType);
        }
    }
    return typeFilters;
}

12 Source : FrameworkServlet.java
with Apache License 2.0
from langtianya

@SuppressWarnings("unchecked")
private ApplicationContextInitializer<ConfigurableApplicationContext> loadInitializer(String clreplacedName, ConfigurableApplicationContext wac) {
    try {
        Clreplaced<?> initializerClreplaced = ClreplacedUtils.forName(clreplacedName, wac.getClreplacedLoader());
        Clreplaced<?> initializerContextClreplaced = GenericTypeResolver.resolveTypeArgument(initializerClreplaced, ApplicationContextInitializer.clreplaced);
        if (initializerContextClreplaced != null) {
            replacedert.isreplacedignable(initializerContextClreplaced, wac.getClreplaced(), String.format("Could not add context initializer [%s] since its generic parameter [%s] " + "is not replacedignable from the type of application context used by this " + "framework servlet [%s]: ", initializerClreplaced.getName(), initializerContextClreplaced.getName(), wac.getClreplaced().getName()));
        }
        return BeanUtils.instantiateClreplaced(initializerClreplaced, ApplicationContextInitializer.clreplaced);
    } catch (Exception ex) {
        throw new IllegalArgumentException(String.format("Could not instantiate clreplaced [%s] specified " + "via 'contextInitializerClreplacedes' init-param", clreplacedName), ex);
    }
}

12 Source : ContextLoader.java
with Apache License 2.0
from langtianya

/**
 * Customize the {@link ConfigurableWebApplicationContext} created by this
 * ContextLoader after config locations have been supplied to the context
 * but before the context is <em>refreshed</em>.
 * <p>The default implementation {@linkplain #determineContextInitializerClreplacedes(ServletContext)
 * determines} what (if any) context initializer clreplacedes have been specified through
 * {@linkplain #CONTEXT_INITIALIZER_CLreplacedES_PARAM context init parameters} and
 * {@linkplain ApplicationContextInitializer#initialize invokes each} with the
 * given web application context.
 * <p>Any {@code ApplicationContextInitializers} implementing
 * {@link org.springframework.core.Ordered Ordered} or marked with @{@link
 * org.springframework.core.annotation.Order Order} will be sorted appropriately.
 * @param sc the current servlet context
 * @param wac the newly created application context
 * @see #CONTEXT_INITIALIZER_CLreplacedES_PARAM
 * @see ApplicationContextInitializer#initialize(ConfigurableApplicationContext)
 */
protected void customizeContext(ServletContext sc, ConfigurableWebApplicationContext wac) {
    List<Clreplaced<ApplicationContextInitializer<ConfigurableApplicationContext>>> initializerClreplacedes = determineContextInitializerClreplacedes(sc);
    for (Clreplaced<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerClreplaced : initializerClreplacedes) {
        Clreplaced<?> initializerContextClreplaced = GenericTypeResolver.resolveTypeArgument(initializerClreplaced, ApplicationContextInitializer.clreplaced);
        if (initializerContextClreplaced != null) {
            replacedert.isreplacedignable(initializerContextClreplaced, wac.getClreplaced(), String.format("Could not add context initializer [%s] since its generic parameter [%s] " + "is not replacedignable from the type of application context used by this " + "context loader [%s]: ", initializerClreplaced.getName(), initializerContextClreplaced.getName(), wac.getClreplaced().getName()));
        }
        this.contextInitializers.add(BeanUtils.instantiateClreplaced(initializerClreplaced));
    }
    AnnotationAwareOrderComparator.sort(this.contextInitializers);
    for (ApplicationContextInitializer<ConfigurableApplicationContext> initializer : this.contextInitializers) {
        initializer.initialize(wac);
    }
}

12 Source : ComponentScanAnnotationParser.java
with Apache License 2.0
from langtianya

private List<TypeFilter> typeFiltersFor(AnnotationAttributes filterAttributes) {
    List<TypeFilter> typeFilters = new ArrayList<TypeFilter>();
    FilterType filterType = filterAttributes.getEnum("type");
    for (Clreplaced<?> filterClreplaced : filterAttributes.getAliasedClreplacedArray("clreplacedes", ComponentScan.Filter.clreplaced, null)) {
        switch(filterType) {
            case ANNOTATION:
                replacedert.isreplacedignable(Annotation.clreplaced, filterClreplaced, "An error occured while processing a @ComponentScan ANNOTATION type filter: ");
                @SuppressWarnings("unchecked")
                Clreplaced<Annotation> annotationType = (Clreplaced<Annotation>) filterClreplaced;
                typeFilters.add(new AnnotationTypeFilter(annotationType));
                break;
            case replacedIGNABLE_TYPE:
                typeFilters.add(new replacedignableTypeFilter(filterClreplaced));
                break;
            case CUSTOM:
                replacedert.isreplacedignable(TypeFilter.clreplaced, filterClreplaced, "An error occured while processing a @ComponentScan CUSTOM type filter: ");
                typeFilters.add(BeanUtils.instantiateClreplaced(filterClreplaced, TypeFilter.clreplaced));
                break;
            default:
                throw new IllegalArgumentException("Filter type not supported with Clreplaced value: " + filterType);
        }
    }
    for (String expression : filterAttributes.getStringArray("pattern")) {
        switch(filterType) {
            case ASPECTJ:
                typeFilters.add(new AspectJTypeFilter(expression, this.resourceLoader.getClreplacedLoader()));
                break;
            case REGEX:
                typeFilters.add(new RegexPatternTypeFilter(Pattern.compile(expression)));
                break;
            default:
                throw new IllegalArgumentException("Filter type not supported with String pattern: " + filterType);
        }
    }
    return typeFilters;
}

12 Source : NonReactiveMongoNativeJavaDriverQueryExecutor.java
with Apache License 2.0
from krraghavan

@SuppressWarnings({ "ConstantConditions", "unchecked" })
private /*
   * Called when results are not paged or if paged, the return is to a list type.
   */
Object getNonPageResults(QueryProvider<Pageable> queryProvider, MongoCursor<Doreplacedent> cursor) {
    Clreplaced returnClreplaced = queryProvider.getMethodReturnType();
    boolean isCollectionTypeReturn = Iterable.clreplaced.isreplacedignableFrom(returnClreplaced);
    final Clreplaced outputClreplaced = queryProvider.getOutputClreplaced();
    replacedert.isTrue(!isCollectionTypeReturn || isCollectionTypeReturn && List.clreplaced.isreplacedignableFrom(returnClreplaced), "Only list return type is supported. " + returnClreplaced.getName() + " is not replacedignable to list");
    String resultKey = queryProvider.getQueryResultKey();
    if (BeanUtils.isSimpleValueType(outputClreplaced)) {
        // either primitives/String or list of such objects.
        if (isCollectionTypeReturn) {
            List retval = new ArrayList<>();
            while (cursor.hasNext()) {
                cursor.forEachRemaining(d -> retval.add(getValueFromDoreplacedent(resultKey, d)));
            }
            return retval;
        } else {
            if (cursor.hasNext()) {
                Doreplacedent next = cursor.next();
                return getValueFromDoreplacedent(resultKey, next);
            }
        }
    } else {
        // deserialize into complex object.  Single of list of complex objects
        if (isCollectionTypeReturn) {
            List retval = new ArrayList<>();
            cursor.forEachRemaining(d -> {
                // resultKey would typically be empty for paged results.  But if the
                // query projects other values, the resultKey provides a way to extract
                // the results piece
                Object o = StringUtils.isNotEmpty(resultKey) ? d.get(resultKey) : d;
                // If the query has a pageable in it the results would be returned as a DBObject
                // but the actual results are in the "results" key.  In this case we're not returning
                // a page but a list so we'll just throw away the totals
                Doreplacedent doreplacedent = getDoreplacedent(o);
                if (queryProvider.isPageable()) {
                    // even though we're not returning a Page, the query itself could involve a Pageable.
                    // in this case we'll throw away the totalResultSetCount from the returned results.
                    Object results = doreplacedent.get(RESULTS);
                    replacedert.isreplacedignable(List.clreplaced, results.getClreplaced(), "Expecting a list of results");
                    extractDeserializedListFromResults(outputClreplaced, retval, (List) results);
                    replacedert.isTrue(!cursor.hasNext(), "For pageable type we only expect one record");
                } else {
                    // returning a collection for non-paged complex objects.
                    retval.add(deserialize(outputClreplaced, doreplacedent));
                }
            });
            return retval;
        } else {
            Doreplacedent next = cursor.next();
            Doreplacedent d = StringUtils.isNotEmpty(resultKey) ? (Doreplacedent) next.get(resultKey) : next;
            replacedert.isTrue(!cursor.hasNext(), "Return type was for a single object but query returned multiple records");
            return deserialize(outputClreplaced, d);
        }
    }
    return null;
}

12 Source : ScheduledConfig.java
with Apache License 2.0
from jufeng98

@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    for (SpringScheduledCron springScheduledCron : cronRepository.findAll()) {
        Clreplaced<?> clazz;
        Object task;
        try {
            clazz = Clreplaced.forName(springScheduledCron.getCronKey());
            task = context.getBean(clazz);
        } catch (ClreplacedNotFoundException e) {
            throw new IllegalArgumentException("spring_scheduled_cron表数据" + springScheduledCron.getCronKey() + "有误", e);
        } catch (BeansException e) {
            throw new IllegalArgumentException(springScheduledCron.getCronKey() + "未纳入到spring管理", e);
        }
        replacedert.isreplacedignable(ScheduledOfTask.clreplaced, task.getClreplaced(), "定时任务类必须实现ScheduledOfTask接口");
        // 可以通过改变数据库数据进而实现动态改变执行周期
        taskRegistrar.addTriggerTask(((Runnable) task), triggerContext -> {
            String cronExpression = cronRepository.findByCronKey(springScheduledCron.getCronKey()).getCronExpression();
            return new CronTrigger(cronExpression).nextExecutionTime(triggerContext);
        });
    }
}

11 Source : ComponentScanAnnotationParser.java
with MIT License
from Vip-Augus

private List<TypeFilter> typeFiltersFor(AnnotationAttributes filterAttributes) {
    List<TypeFilter> typeFilters = new ArrayList<>();
    FilterType filterType = filterAttributes.getEnum("type");
    for (Clreplaced<?> filterClreplaced : filterAttributes.getClreplacedArray("clreplacedes")) {
        switch(filterType) {
            case ANNOTATION:
                replacedert.isreplacedignable(Annotation.clreplaced, filterClreplaced, "@ComponentScan ANNOTATION type filter requires an annotation type");
                @SuppressWarnings("unchecked")
                Clreplaced<Annotation> annotationType = (Clreplaced<Annotation>) filterClreplaced;
                typeFilters.add(new AnnotationTypeFilter(annotationType));
                break;
            case replacedIGNABLE_TYPE:
                typeFilters.add(new replacedignableTypeFilter(filterClreplaced));
                break;
            case CUSTOM:
                replacedert.isreplacedignable(TypeFilter.clreplaced, filterClreplaced, "@ComponentScan CUSTOM type filter requires a TypeFilter implementation");
                TypeFilter filter = BeanUtils.instantiateClreplaced(filterClreplaced, TypeFilter.clreplaced);
                ParserStrategyUtils.invokeAwareMethods(filter, this.environment, this.resourceLoader, this.registry);
                typeFilters.add(filter);
                break;
            default:
                throw new IllegalArgumentException("Filter type not supported with Clreplaced value: " + filterType);
        }
    }
    for (String expression : filterAttributes.getStringArray("pattern")) {
        switch(filterType) {
            case ASPECTJ:
                typeFilters.add(new AspectJTypeFilter(expression, this.resourceLoader.getClreplacedLoader()));
                break;
            case REGEX:
                typeFilters.add(new RegexPatternTypeFilter(Pattern.compile(expression)));
                break;
            default:
                throw new IllegalArgumentException("Filter type not supported with String pattern: " + filterType);
        }
    }
    return typeFilters;
}

11 Source : NonReactiveMongoNativeJavaDriverQueryExecutor.java
with Apache License 2.0
from krraghavan

@SuppressWarnings({ "ConstantConditions", "unchecked" })
private Object getPageableResults(QueryProvider<Pageable> queryProvider, MongoCursor<Doreplacedent> cursor) {
    Clreplaced returnClreplaced = queryProvider.getMethodReturnType();
    boolean isCollectionTypeReturn = Iterable.clreplaced.isreplacedignableFrom(returnClreplaced);
    final Clreplaced outputClreplaced = queryProvider.getOutputClreplaced();
    replacedert.isTrue(!isCollectionTypeReturn || isCollectionTypeReturn && Page.clreplaced.isreplacedignableFrom(returnClreplaced), "Only page return type is supported. " + returnClreplaced.getName() + " is not replacedignable to page");
    String resultKey = queryProvider.getQueryResultKey();
    // we're returning a page full of data with a Pageable argument.  The query always returns
    // a single object with "results" and "totalResultSetCount".  We just package that in a
    // Page and return.
    Pageable pageable = queryProvider.getPageable();
    if (BeanUtils.isSimpleValueType(outputClreplaced)) {
        // either primitives/String or list of such objects.
        List pageContents = new ArrayList<>();
        Page retval = new PageImpl(new ArrayList(), pageable, 0);
        // expect only one object.
        if (cursor.hasNext()) {
            Doreplacedent dbObject = cursor.next();
            Object results = dbObject.get(RESULTS);
            if (results == null) {
                return null;
            }
            replacedert.isreplacedignable(DBObject.clreplaced, results.getClreplaced(), "Expecting DBObject type");
            replacedert.isreplacedignable(List.clreplaced, results.getClreplaced(), "Expecting a list of results");
            extractDeserializedListFromResults(outputClreplaced, pageContents, (List) results);
            retval = new PageImpl(pageContents, pageable, (int) dbObject.get("totalResultSetCount"));
        }
        replacedert.isTrue(!cursor.hasNext(), "Expecting only one record in paged query");
        return retval;
    } else {
        // deserialize into complex object
        final Object[] returnValue = new Object[1];
        if (isCollectionTypeReturn) {
            List pageContents = new ArrayList<>();
            cursor.forEachRemaining(d -> {
                Object o = StringUtils.isNotEmpty(resultKey) ? d.get(resultKey) : d;
                // If the query has a pageable in it the results would be returned as a DBObject
                // but the actual results are in the "results" key.  In this case we're not returning
                // a page but a list so we'll just throw away the totals
                Doreplacedent dbObject = getDoreplacedent(o);
                Object results = dbObject.get(RESULTS);
                replacedert.isreplacedignable(List.clreplaced, results.getClreplaced(), "Expecting a list of results");
                extractDeserializedListFromResults(outputClreplaced, pageContents, (List) results);
                returnValue[0] = new PageImpl(pageContents, pageable, (int) dbObject.get("totalResultSetCount"));
                replacedert.isTrue(!cursor.hasNext(), "For pageable type we only expect one record");
            });
            return returnValue[0];
        }
    }
    throw new IllegalStateException("Unexpected exit from block");
}

See More Examples