Here are the examples of the java api org.springframework.core.annotation.AnnotationAttributes taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
328 Examples
19
View Source File : RafyApplicationAnnotationHolder.java
License : Apache License 2.0
Project Creator : zgynhqf
License : Apache License 2.0
Project Creator : zgynhqf
/**
* RafyApplication Annotation 值保存类。
*
* @author: huqingfang
* @date: 2019-01-23 17:00
*/
public abstract clreplaced RafyApplicationAnnotationHolder {
private static AnnotationAttributes annotationAttributes;
public static Clreplaced<?>[] getEnreplacedyPackageClreplacedes() {
return annotationAttributes.getClreplacedArray("enreplacedyPackageClreplacedes");
}
static void setAnnotationAttributes(AnnotationAttributes value) {
annotationAttributes = value;
}
}
19
View Source File : RafyApplicationAnnotationHolder.java
License : Apache License 2.0
Project Creator : zgynhqf
License : Apache License 2.0
Project Creator : zgynhqf
static void setAnnotationAttributes(AnnotationAttributes value) {
annotationAttributes = value;
}
19
View Source File : CloudFoundryWebEndpointDiscoverer.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private boolean isHealthEndpointExtension(Object extensionBean) {
AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(extensionBean.getClreplaced(), EndpointWebExtension.clreplaced);
Clreplaced<?> endpoint = (attributes != null) ? attributes.getClreplaced("endpoint") : null;
return (endpoint != null && HealthEndpoint.clreplaced.isreplacedignableFrom(endpoint));
}
19
View Source File : DataSourceClassResolver.java
License : Apache License 2.0
Project Creator : Yiuman
License : Apache License 2.0
Project Creator : Yiuman
/**
* 通过 AnnotatedElement 查找标记的注解, 映射为 DatasourceHolder
*
* @param ae AnnotatedElement
* @return 数据源映射持有者
*/
private String findDataSourceAttribute(AnnotatedElement ae) {
AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(ae, DataSource.clreplaced);
if (attributes != null) {
return attributes.getString("value");
}
return null;
}
19
View Source File : MergedSqlConfig.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
private static String getString(AnnotationAttributes attributes, String attributeName, String defaultValue) {
String value = attributes.getString(attributeName);
if ("".equals(value)) {
value = defaultValue;
}
return value;
}
19
View Source File : BootstrapUtils.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
private static Clreplaced<?> resolveDefaultTestContextBootstrapper(Clreplaced<?> testClreplaced) throws Exception {
ClreplacedLoader clreplacedLoader = BootstrapUtils.clreplaced.getClreplacedLoader();
AnnotationAttributes attributes = AnnotatedElementUtils.findMergedAnnotationAttributes(testClreplaced, WEB_APP_CONFIGURATION_ANNOTATION_CLreplaced_NAME, false, false);
if (attributes != null) {
return ClreplacedUtils.forName(DEFAULT_WEB_TEST_CONTEXT_BOOTSTRAPPER_CLreplaced_NAME, clreplacedLoader);
}
return ClreplacedUtils.forName(DEFAULT_TEST_CONTEXT_BOOTSTRAPPER_CLreplaced_NAME, clreplacedLoader);
}
19
View Source File : LoadTimeWeavingConfiguration.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* {@code @Configuration} clreplaced that registers a {@link LoadTimeWeaver} bean.
*
* <p>This configuration clreplaced is automatically imported when using the
* {@link EnableLoadTimeWeaving} annotation. See {@code @EnableLoadTimeWeaving}
* javadoc for complete usage details.
*
* @author Chris Beams
* @since 3.1
* @see LoadTimeWeavingConfigurer
* @see ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME
*/
@Configuration
public clreplaced LoadTimeWeavingConfiguration implements ImportAware, BeanClreplacedLoaderAware {
@Nullable
private AnnotationAttributes enableLTW;
@Nullable
private LoadTimeWeavingConfigurer ltwConfigurer;
@Nullable
private ClreplacedLoader beanClreplacedLoader;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableLTW = AnnotationConfigUtils.attributesFor(importMetadata, EnableLoadTimeWeaving.clreplaced);
if (this.enableLTW == null) {
throw new IllegalArgumentException("@EnableLoadTimeWeaving is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
@Autowired(required = false)
public void setLoadTimeWeavingConfigurer(LoadTimeWeavingConfigurer ltwConfigurer) {
this.ltwConfigurer = ltwConfigurer;
}
@Override
public void setBeanClreplacedLoader(ClreplacedLoader beanClreplacedLoader) {
this.beanClreplacedLoader = beanClreplacedLoader;
}
@Bean(name = ConfigurableApplicationContext.LOAD_TIME_WEAVER_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public LoadTimeWeaver loadTimeWeaver() {
replacedert.state(this.beanClreplacedLoader != null, "No ClreplacedLoader set");
LoadTimeWeaver loadTimeWeaver = null;
if (this.ltwConfigurer != null) {
// The user has provided a custom LoadTimeWeaver instance
loadTimeWeaver = this.ltwConfigurer.getLoadTimeWeaver();
}
if (loadTimeWeaver == null) {
// No custom LoadTimeWeaver provided -> fall back to the default
loadTimeWeaver = new DefaultContextLoadTimeWeaver(this.beanClreplacedLoader);
}
if (this.enableLTW != null) {
AspectJWeaving aspectJWeaving = this.enableLTW.getEnum("aspectjWeaving");
switch(aspectJWeaving) {
case DISABLED:
// AJ weaving is disabled -> do nothing
break;
case AUTODETECT:
if (this.beanClreplacedLoader.getResource(AspectJWeavingEnabler.ASPECTJ_AOP_XML_RESOURCE) == null) {
// No aop.xml present on the clreplacedpath -> treat as 'disabled'
break;
}
// aop.xml is present on the clreplacedpath -> enable
AspectJWeavingEnabler.enableAspectJWeaving(loadTimeWeaver, this.beanClreplacedLoader);
break;
case ENABLED:
AspectJWeavingEnabler.enableAspectJWeaving(loadTimeWeaver, this.beanClreplacedLoader);
break;
}
}
return loadTimeWeaver;
}
}
19
View Source File : OnMissingPropertyCondition.java
License : Apache License 2.0
Project Creator : spring-projects
License : Apache License 2.0
Project Creator : spring-projects
private AnnotationAttributes resolveAnnotationAttributes(List<AnnotationAttributes> annotationAttributesList, int index) {
if (index < annotationAttributesList.size()) {
return annotationAttributesList.get(index);
} else {
AnnotationAttributes newAnnotationAttributes = new AnnotationAttributes();
annotationAttributesList.add(newAnnotationAttributes);
return newAnnotationAttributes;
}
}
19
View Source File : ClusterAwareConfiguration.java
License : Apache License 2.0
Project Creator : spring-projects
License : Apache License 2.0
Project Creator : spring-projects
protected boolean isStrictMatchConfigured(@NonNull AnnotationAttributes enableClusterAwareAttributes) {
return enableClusterAwareAttributes != null && Boolean.TRUE.equals(enableClusterAwareAttributes.getBoolean(STRICT_MATCH_ATTRIBUTE_NAME));
}
19
View Source File : AbstractAnnotationBasedBeanRegistrar.java
License : Apache License 2.0
Project Creator : otto-de
License : Apache License 2.0
Project Creator : otto-de
private void registerBeanDefinitions(final AnnotationAttributes annotationAttributes, final BeanDefinitionRegistry registry) {
if (annotationAttributes != null) {
final String channelName = getChannelName(annotationAttributes);
final String beanName = getBeanName(annotationAttributes, channelName);
registerBeanDefinitions(channelName, beanName, annotationAttributes, registry);
}
}
19
View Source File : AnnotationNacosInjectedBeanPostProcessor.java
License : Apache License 2.0
Project Creator : nacos-group
License : Apache License 2.0
Project Creator : nacos-group
private Map<String, Object> getNacosProperties(AnnotationAttributes attributes) {
return (Map<String, Object>) attributes.get("properties");
}
19
View Source File : AutowiredAnnotationBeanPostProcessor.java
License : MIT License
Project Creator : mindcarver
License : MIT License
Project Creator : mindcarver
/**
* Determine if the annotated field or method requires its dependency.
* <p>A 'required' dependency means that autowiring should fail when no beans
* are found. Otherwise, the autowiring process will simply bypreplaced the field
* or method when no beans are found.
* @param ann the Autowired annotation
* @return whether the annotation indicates that a dependency is required
*/
protected boolean determineRequiredStatus(AnnotationAttributes ann) {
return (!ann.containsKey(this.requiredParameterName) || this.requiredParameterValue == ann.getBoolean(this.requiredParameterName));
}
19
View Source File : AnnotationAttributesBootstrap.java
License : Apache License 2.0
Project Creator : mercyblitz
License : Apache License 2.0
Project Creator : mercyblitz
public static void main(String[] args) {
// AnnotatedElement annotatedElement = TransactionalService.clreplaced;
AnnotatedElement annotatedElement = TransactionalServiceBean.clreplaced;
// 获取 @Service 注解属性独享
AnnotationAttributes serviceAttributes = AnnotatedElementUtils.getMergedAnnotationAttributes(annotatedElement, Service.clreplaced);
// 获取 @Transactional 注解属性独享
AnnotationAttributes transactionalAttributes = AnnotatedElementUtils.getMergedAnnotationAttributes(annotatedElement, Transactional.clreplaced);
// 输出
print(serviceAttributes);
print(transactionalAttributes);
}
19
View Source File : DubboFeignProviderBeanPostProcessor.java
License : Apache License 2.0
Project Creator : matevip
License : Apache License 2.0
Project Creator : matevip
private Clreplaced<?> resolveServiceInterfaceClreplaced(AnnotationAttributes attributes, Clreplaced<?> defaultInterfaceClreplaced) throws IllegalArgumentException {
ClreplacedLoader clreplacedLoader = defaultInterfaceClreplaced != null ? defaultInterfaceClreplaced.getClreplacedLoader() : Thread.currentThread().getContextClreplacedLoader();
Clreplaced<?> interfaceClreplaced = getAttribute(attributes, "interfaceClreplaced");
if (void.clreplaced.equals(interfaceClreplaced)) {
interfaceClreplaced = null;
String interfaceClreplacedName = getAttribute(attributes, "interfaceName");
if (hasText(interfaceClreplacedName)) {
if (ClreplacedUtils.isPresent(interfaceClreplacedName, clreplacedLoader)) {
interfaceClreplaced = resolveClreplacedName(interfaceClreplacedName, clreplacedLoader);
}
}
}
if (interfaceClreplaced == null && defaultInterfaceClreplaced != null) {
// Find all interfaces from the annotated clreplaced
// To resolve an issue : https://github.com/apache/dubbo/issues/3251
Clreplaced<?>[] allInterfaces = getAllInterfacesForClreplaced(defaultInterfaceClreplaced);
if (allInterfaces.length > 0) {
interfaceClreplaced = allInterfaces[0];
}
}
replacedert.notNull(interfaceClreplaced, "@Service interfaceClreplaced() or interfaceName() or interface clreplaced must be present!");
replacedert.isTrue(interfaceClreplaced.isInterface(), "The annotated type must be an interface!");
return interfaceClreplaced;
}
19
View Source File : AbstractLockConfiguration.java
License : Apache License 2.0
Project Creator : lukas-krecan
License : Apache License 2.0
Project Creator : lukas-krecan
abstract clreplaced AbstractLockConfiguration implements ImportAware {
protected AnnotationAttributes annotationAttributes;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.annotationAttributes = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableSchedulerLock.clreplaced.getName(), false));
if (this.annotationAttributes == null) {
throw new IllegalArgumentException("@EnableSchedulerLock is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
protected int getOrder() {
return annotationAttributes.getNumber("order");
}
}
19
View Source File : AnnotationReadingVisitorUtils.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
public static AnnotationAttributes convertClreplacedValues(ClreplacedLoader clreplacedLoader, AnnotationAttributes original, boolean clreplacedValuesreplacedtring) {
if (original == null) {
return null;
}
AnnotationAttributes result = new AnnotationAttributes(original.size());
for (Map.Entry<String, Object> entry : original.entrySet()) {
try {
Object value = entry.getValue();
if (value instanceof AnnotationAttributes) {
value = convertClreplacedValues(clreplacedLoader, (AnnotationAttributes) value, clreplacedValuesreplacedtring);
} else if (value instanceof AnnotationAttributes[]) {
AnnotationAttributes[] values = (AnnotationAttributes[]) value;
for (int i = 0; i < values.length; i++) {
values[i] = convertClreplacedValues(clreplacedLoader, values[i], clreplacedValuesreplacedtring);
}
} else if (value instanceof Type) {
value = (clreplacedValuesreplacedtring ? ((Type) value).getClreplacedName() : clreplacedLoader.loadClreplaced(((Type) value).getClreplacedName()));
} else if (value instanceof Type[]) {
Type[] array = (Type[]) value;
Object[] convArray = (clreplacedValuesreplacedtring ? new String[array.length] : new Clreplaced<?>[array.length]);
for (int i = 0; i < array.length; i++) {
convArray[i] = (clreplacedValuesreplacedtring ? array[i].getClreplacedName() : clreplacedLoader.loadClreplaced(array[i].getClreplacedName()));
}
value = convArray;
} else if (clreplacedValuesreplacedtring) {
if (value instanceof Clreplaced) {
value = ((Clreplaced<?>) value).getName();
} else if (value instanceof Clreplaced[]) {
Clreplaced<?>[] clazzArray = (Clreplaced[]) value;
String[] newValue = new String[clazzArray.length];
for (int i = 0; i < clazzArray.length; i++) {
newValue[i] = clazzArray[i].getName();
}
value = newValue;
}
}
result.put(entry.getKey(), value);
} catch (Exception ex) {
// Clreplaced not found - can't resolve clreplaced reference in annotation attribute.
result.put(entry.getKey(), ex);
}
}
return result;
}
19
View Source File : LoadTimeWeavingConfiguration.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
/**
* {@code @Configuration} clreplaced that registers a {@link LoadTimeWeaver} bean.
*
* <p>This configuration clreplaced is automatically imported when using the
* {@link EnableLoadTimeWeaving} annotation. See {@code @EnableLoadTimeWeaving}
* javadoc for complete usage details.
*
* @author Chris Beams
* @since 3.1
* @see LoadTimeWeavingConfigurer
* @see ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME
*/
@Configuration
public clreplaced LoadTimeWeavingConfiguration implements ImportAware, BeanClreplacedLoaderAware {
private AnnotationAttributes enableLTW;
private LoadTimeWeavingConfigurer ltwConfigurer;
private ClreplacedLoader beanClreplacedLoader;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableLTW = AnnotationConfigUtils.attributesFor(importMetadata, EnableLoadTimeWeaving.clreplaced);
if (this.enableLTW == null) {
throw new IllegalArgumentException("@EnableLoadTimeWeaving is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
@Autowired(required = false)
public void setLoadTimeWeavingConfigurer(LoadTimeWeavingConfigurer ltwConfigurer) {
this.ltwConfigurer = ltwConfigurer;
}
@Override
public void setBeanClreplacedLoader(ClreplacedLoader beanClreplacedLoader) {
this.beanClreplacedLoader = beanClreplacedLoader;
}
@Bean(name = ConfigurableApplicationContext.LOAD_TIME_WEAVER_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public LoadTimeWeaver loadTimeWeaver() {
LoadTimeWeaver loadTimeWeaver = null;
if (this.ltwConfigurer != null) {
// the user has provided a custom LTW instance
loadTimeWeaver = ltwConfigurer.getLoadTimeWeaver();
}
if (loadTimeWeaver == null) {
// no custom LTW provided -> fall back to the default
loadTimeWeaver = new DefaultContextLoadTimeWeaver(this.beanClreplacedLoader);
}
AspectJWeaving aspectJWeaving = this.enableLTW.getEnum("aspectjWeaving");
switch(aspectJWeaving) {
case DISABLED:
// AJ weaving is disabled -> do nothing
break;
case AUTODETECT:
if (this.beanClreplacedLoader.getResource(AspectJWeavingEnabler.ASPECTJ_AOP_XML_RESOURCE) == null) {
// No aop.xml present on the clreplacedpath -> treat as 'disabled'
break;
}
// aop.xml is present on the clreplacedpath -> enable
AspectJWeavingEnabler.enableAspectJWeaving(loadTimeWeaver, this.beanClreplacedLoader);
break;
case ENABLED:
AspectJWeavingEnabler.enableAspectJWeaving(loadTimeWeaver, this.beanClreplacedLoader);
break;
}
return loadTimeWeaver;
}
}
19
View Source File : AbstractLimiterAnnotationParser.java
License : Apache License 2.0
Project Creator : jjj124
License : Apache License 2.0
Project Creator : jjj124
public String getLimiter(AnnotationAttributes attributes) {
return attributes.getString("limiter");
}
19
View Source File : AbstractLimiterAnnotationParser.java
License : Apache License 2.0
Project Creator : jjj124
License : Apache License 2.0
Project Creator : jjj124
public String getFallback(AnnotationAttributes attributes) {
return attributes.getString("fallback");
}
19
View Source File : AbstractLimiterAnnotationParser.java
License : Apache License 2.0
Project Creator : jjj124
License : Apache License 2.0
Project Creator : jjj124
public String getKey(AnnotationAttributes attributes) {
return attributes.getString("key");
}
19
View Source File : AbstractLimiterAnnotationParser.java
License : Apache License 2.0
Project Creator : jjj124
License : Apache License 2.0
Project Creator : jjj124
public String getErrorHandler(AnnotationAttributes attributes) {
return attributes.getString("errorHandler");
}
19
View Source File : DiscoveredOperationsFactory.java
License : Apache License 2.0
Project Creator : hello-shf
License : Apache License 2.0
Project Creator : hello-shf
private O createOperation(String endpointId, Object target, Method method, OperationType operationType, Clreplaced<? extends Annotation> annotationType) {
AnnotationAttributes annotationAttributes = AnnotatedElementUtils.getMergedAnnotationAttributes(method, annotationType);
if (annotationAttributes == null) {
return null;
}
DiscoveredOperationMethod operationMethod = new DiscoveredOperationMethod(method, operationType, annotationAttributes);
OperationInvoker invoker = new ReflectiveOperationInvoker(target, operationMethod, this.parameterValueMapper);
invoker = applyAdvisors(endpointId, operationMethod, invoker);
return createOperation(endpointId, operationMethod, invoker);
}
19
View Source File : MybatisAnnotationAuditingConfiguration.java
License : Apache License 2.0
Project Creator : easybest
License : Apache License 2.0
Project Creator : easybest
/**
* .
*
* @author JARVIS SONG
* @since 2.0.1
*/
public clreplaced MybatisAnnotationAuditingConfiguration implements MybatisAuditingConfiguration {
private static final String MISSING_ANNOTATION_ATTRIBUTES = "Couldn't find annotation attributes for %s in %s!";
private final AnnotationAttributes attributes;
/**
* Creates a new instance of {@link AnnotationAuditingConfiguration} for the given
* {@link AnnotationMetadata} and annotation type.
* @param metadata must not be {@literal null}.
* @param annotation must not be {@literal null}.
*/
public MybatisAnnotationAuditingConfiguration(AnnotationMetadata metadata, Clreplaced<? extends Annotation> annotation) {
replacedert.notNull(metadata, "AnnotationMetadata must not be null!");
replacedert.notNull(annotation, "Annotation must not be null!");
Map<String, Object> attributesSource = metadata.getAnnotationAttributes(annotation.getName());
if (attributesSource == null) {
throw new IllegalArgumentException(String.format(MISSING_ANNOTATION_ATTRIBUTES, annotation, metadata));
}
this.attributes = new AnnotationAttributes(attributesSource);
}
@Override
public String getAuditorAwareRef() {
return this.attributes.getString("auditorAwareRef");
}
@Override
public boolean isSetDates() {
return this.attributes.getBoolean("setDates");
}
@Override
public String getDateTimeProviderRef() {
return this.attributes.getString("dateTimeProviderRef");
}
@Override
public boolean isModifyOnCreate() {
return this.attributes.getBoolean("modifyOnCreate");
}
@Override
public String getSqlSessionTemplateRef() {
return this.attributes.getString("sqlSessionTemplateRef");
}
}
19
View Source File : AbstractLimiterAware.java
License : MIT License
Project Creator : aoju
License : MIT License
Project Creator : aoju
/**
* @author Kimi Liu
* @version 6.2.1
* @since JDK 1.8+
*/
public abstract clreplaced AbstractLimiterAware implements ImportAware {
protected AnnotationAttributes enableLimiter;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableLimiter = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableLimiter.clreplaced.getName(), false));
if (this.enableLimiter == null) {
throw new IllegalArgumentException("@EnableLimiter is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
}
18
View Source File : DiscoveredJmxOperationTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private DiscoveredJmxOperation getOperation(String methodName) {
Method method = findMethod(methodName);
AnnotationAttributes annotationAttributes = new AnnotationAttributes();
annotationAttributes.put("produces", "application/xml");
DiscoveredOperationMethod operationMethod = new DiscoveredOperationMethod(method, OperationType.READ, annotationAttributes);
DiscoveredJmxOperation operation = new DiscoveredJmxOperation(EndpointId.of("test"), operationMethod, mock(OperationInvoker.clreplaced));
return operation;
}
18
View Source File : DiscoveredOperationsFactory.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private O createOperation(EndpointId endpointId, Object target, Method method, OperationType operationType, Clreplaced<? extends Annotation> annotationType) {
AnnotationAttributes annotationAttributes = AnnotatedElementUtils.getMergedAnnotationAttributes(method, annotationType);
if (annotationAttributes == null) {
return null;
}
DiscoveredOperationMethod operationMethod = new DiscoveredOperationMethod(method, operationType, annotationAttributes);
OperationInvoker invoker = new ReflectiveOperationInvoker(target, operationMethod, this.parameterValueMapper);
invoker = applyAdvisors(endpointId, operationMethod, invoker);
return createOperation(endpointId, operationMethod, invoker);
}
18
View Source File : EasyMapperRegistrar.java
License : MIT License
Project Creator : ymm-tech
License : MIT License
Project Creator : ymm-tech
private String getClusterName(AnnotationAttributes mapperAttributes) {
return mapperAttributes.getString("clusterRouter");
}
18
View Source File : SpringTransactionAnnotationParser.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
@Nullable
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {
// 解析事务注解的属性
AnnotationAttributes attributes = AnnotatedElementUtils.findMergedAnnotationAttributes(element, Transactional.clreplaced, false, false);
if (attributes != null) {
return parseTransactionAnnotation(attributes);
} else {
return null;
}
}
18
View Source File : JtaTransactionAnnotationParser.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
@Nullable
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {
AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(element, javax.transaction.Transactional.clreplaced);
if (attributes != null) {
return parseTransactionAnnotation(attributes);
} else {
return null;
}
}
18
View Source File : MergedSqlConfig.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
private static <E extends Enum<?>> E getEnum(AnnotationAttributes attributes, String attributeName, E inheritedOrDefaultValue, E defaultValue) {
E value = attributes.getEnum(attributeName);
if (value == inheritedOrDefaultValue) {
value = defaultValue;
}
return value;
}
18
View Source File : AnnotationMetadataTests.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
private void replacedertMultipleAnnotationsWithIdenticalAttributeNames(AnnotationMetadata metadata) {
AnnotationAttributes attributes1 = (AnnotationAttributes) metadata.getAnnotationAttributes(NamedAnnotation1.clreplaced.getName(), false);
String name1 = attributes1.getString("name");
replacedertThat("name of NamedAnnotation1", name1, is("name 1"));
AnnotationAttributes attributes2 = (AnnotationAttributes) metadata.getAnnotationAttributes(NamedAnnotation2.clreplaced.getName(), false);
String name2 = attributes2.getString("name");
replacedertThat("name of NamedAnnotation2", name2, is("name 2"));
AnnotationAttributes attributes3 = (AnnotationAttributes) metadata.getAnnotationAttributes(NamedAnnotation3.clreplaced.getName(), false);
String name3 = attributes3.getString("name");
replacedertThat("name of NamedAnnotation3", name3, is("name 3"));
}
18
View Source File : MethodMetadataReadingVisitor.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
@Nullable
public AnnotationAttributes getAnnotationAttributes(String annotationName, boolean clreplacedValuesreplacedtring) {
AnnotationAttributes raw = AnnotationReadingVisitorUtils.getMergedAnnotationAttributes(this.attributesMap, this.metaAnnotationMap, annotationName);
if (raw == null) {
return null;
}
return AnnotationReadingVisitorUtils.convertClreplacedValues("method '" + getMethodName() + "'", this.clreplacedLoader, raw, clreplacedValuesreplacedtring);
}
18
View Source File : AnnotationMetadataReadingVisitor.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
@Nullable
public AnnotationAttributes getAnnotationAttributes(String annotationName, boolean clreplacedValuesreplacedtring) {
AnnotationAttributes raw = AnnotationReadingVisitorUtils.getMergedAnnotationAttributes(this.attributesMap, this.metaAnnotationMap, annotationName);
if (raw == null) {
return null;
}
return AnnotationReadingVisitorUtils.convertClreplacedValues("clreplaced '" + getClreplacedName() + "'", this.clreplacedLoader, raw, clreplacedValuesreplacedtring);
}
18
View Source File : AbstractAsyncConfiguration.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Abstract base {@code Configuration} clreplaced providing common structure for enabling
* Spring's asynchronous method execution capability.
*
* @author Chris Beams
* @author Juergen Hoeller
* @author Stephane Nicoll
* @since 3.1
* @see EnableAsync
*/
@Configuration
public abstract clreplaced AbstractAsyncConfiguration implements ImportAware {
@Nullable
protected AnnotationAttributes enableAsync;
@Nullable
protected Supplier<Executor> executor;
@Nullable
protected Supplier<AsyncUncaughtExceptionHandler> exceptionHandler;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableAsync = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableAsync.clreplaced.getName(), false));
if (this.enableAsync == null) {
throw new IllegalArgumentException("@EnableAsync is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
/**
* Collect any {@link AsyncConfigurer} beans through autowiring.
*/
@Autowired(required = false)
void setConfigurers(Collection<AsyncConfigurer> configurers) {
if (CollectionUtils.isEmpty(configurers)) {
return;
}
if (configurers.size() > 1) {
throw new IllegalStateException("Only one AsyncConfigurer may exist");
}
AsyncConfigurer configurer = configurers.iterator().next();
this.executor = configurer::getAsyncExecutor;
this.exceptionHandler = configurer::getAsyncUncaughtExceptionHandler;
}
}
18
View Source File : AbstractCachingConfiguration.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Abstract base {@code @Configuration} clreplaced providing common structure
* for enabling Spring's annotation-driven cache management capability.
*
* @author Chris Beams
* @author Stephane Nicoll
* @author Juergen Hoeller
* @since 3.1
* @see EnableCaching
*/
@Configuration
public abstract clreplaced AbstractCachingConfiguration implements ImportAware {
@Nullable
protected AnnotationAttributes enableCaching;
@Nullable
protected Supplier<CacheManager> cacheManager;
@Nullable
protected Supplier<CacheResolver> cacheResolver;
@Nullable
protected Supplier<KeyGenerator> keyGenerator;
@Nullable
protected Supplier<CacheErrorHandler> errorHandler;
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableCaching = AnnotationAttributes.fromMap(importMetadata.getAnnotationAttributes(EnableCaching.clreplaced.getName(), false));
if (this.enableCaching == null) {
throw new IllegalArgumentException("@EnableCaching is not present on importing clreplaced " + importMetadata.getClreplacedName());
}
}
@Autowired(required = false)
void setConfigurers(Collection<CachingConfigurer> configurers) {
if (CollectionUtils.isEmpty(configurers)) {
return;
}
if (configurers.size() > 1) {
throw new IllegalStateException(configurers.size() + " implementations of " + "CachingConfigurer were found when only 1 was expected. " + "Refactor the configuration such that CachingConfigurer is " + "implemented only once or not at all.");
}
CachingConfigurer configurer = configurers.iterator().next();
useCachingConfigurer(configurer);
}
/**
* Extract the configuration from the nominated {@link CachingConfigurer}.
*/
protected void useCachingConfigurer(CachingConfigurer config) {
this.cacheManager = config::cacheManager;
this.cacheResolver = config::cacheResolver;
this.keyGenerator = config::keyGenerator;
this.errorHandler = config::errorHandler;
}
}
18
View Source File : AutowiredAnnotationBeanPostProcessor.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Determine if the annotated field or method requires its dependency.
* <p>A 'required' dependency means that autowiring should fail when no beans
* are found. Otherwise, the autowiring process will simply bypreplaced the field
* or method when no beans are found.
* @param ann the Autowired annotation
* @return whether the annotation indicates that a dependency is required
* @deprecated since 5.2, in favor of {@link #determineRequiredStatus(MergedAnnotation)}
*/
@Deprecated
protected boolean determineRequiredStatus(AnnotationAttributes ann) {
return (!ann.containsKey(this.requiredParameterName) || this.requiredParameterValue == ann.getBoolean(this.requiredParameterName));
}
18
View Source File : OnMissingPropertyCondition.java
License : Apache License 2.0
Project Creator : spring-projects
License : Apache License 2.0
Project Creator : spring-projects
private String getPrefix(AnnotationAttributes annotationAttributes) {
String prefix = annotationAttributes.getString("prefix");
return StringUtils.hasText(prefix) ? prefix.trim().endsWith(".") ? prefix.trim() : prefix.trim() + "." : "";
}
18
View Source File : SpringTransactionAnnotationParser.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
@Override
@Nullable
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {
AnnotationAttributes attributes = AnnotatedElementUtils.findMergedAnnotationAttributes(element, Transactional.clreplaced, false, false);
if (attributes != null) {
return parseTransactionAnnotation(attributes);
} else {
return null;
}
}
18
View Source File : AnnotationMetadataTests.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
private void replacedertMultipleAnnotationsWithIdenticalAttributeNames(AnnotationMetadata metadata) {
AnnotationAttributes attributes1 = (AnnotationAttributes) metadata.getAnnotationAttributes(NamedAnnotation1.clreplaced.getName(), false);
String name1 = attributes1.getString("name");
replacedertThat(name1).as("name of NamedAnnotation1").isEqualTo("name 1");
AnnotationAttributes attributes2 = (AnnotationAttributes) metadata.getAnnotationAttributes(NamedAnnotation2.clreplaced.getName(), false);
String name2 = attributes2.getString("name");
replacedertThat(name2).as("name of NamedAnnotation2").isEqualTo("name 2");
AnnotationAttributes attributes3 = (AnnotationAttributes) metadata.getAnnotationAttributes(NamedAnnotation3.clreplaced.getName(), false);
String name3 = attributes3.getString("name");
replacedertThat(name3).as("name of NamedAnnotation3").isEqualTo("name 3");
}
18
View Source File : AutowiredAnnotationBeanPostProcessor.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
/**
* Determine if the annotated field or method requires its dependency.
* <p>A 'required' dependency means that autowiring should fail when no beans
* are found. Otherwise, the autowiring process will simply bypreplaced the field or method when no
* beans are found.
*
* @param ann the Autowired annotation
*
* @return whether the annotation indicates that a dependency is required
*
* @deprecated since 5.2, in favor of {@link #determineRequiredStatus(MergedAnnotation)}
*/
@Deprecated
protected boolean determineRequiredStatus(AnnotationAttributes ann) {
return (!ann.containsKey(this.requiredParameterName) || this.requiredParameterValue == ann.getBoolean(this.requiredParameterName));
}
18
View Source File : MessageQueueReceiverEndpointBeanRegistrar.java
License : Apache License 2.0
Project Creator : otto-de
License : Apache License 2.0
Project Creator : otto-de
@Override
protected void registerBeanDefinitions(final String channelName, final String beanName, final AnnotationAttributes annotationAttributes, final BeanDefinitionRegistry registry) {
if (!registry.containsBeanDefinition(beanName)) {
registry.registerBeanDefinition(beanName, genericBeanDefinition(DelegateMessageQueueReceiverEndpoint.clreplaced).addConstructorArgValue(channelName).setDependencyCheck(DEPENDENCY_CHECK_ALL).getBeanDefinition());
LOG.info("Registered MessageQueueReceiverEndpoint {} with for channelName {}", beanName, channelName);
} else {
throw new BeanCreationException(beanName, format("MessageQueueReceiverEndpoint %s is already registered.", beanName));
}
}
18
View Source File : AbstractAnnotationBasedBeanRegistrar.java
License : Apache License 2.0
Project Creator : otto-de
License : Apache License 2.0
Project Creator : otto-de
private String getChannelName(final AnnotationAttributes annotationAttributes) {
return environment.resolvePlaceholders(annotationAttributes.getString("channelName"));
}
18
View Source File : AbstractAnnotationBasedBeanRegistrar.java
License : Apache License 2.0
Project Creator : otto-de
License : Apache License 2.0
Project Creator : otto-de
private String getBeanName(final AnnotationAttributes annotationAttributes, final String channelName) {
return Objects.toString(emptyToNull(annotationAttributes.getString("name")), beanNameFor(getAnnotationType(), channelName));
}
18
View Source File : NacosValueAnnotationBeanPostProcessor.java
License : Apache License 2.0
Project Creator : nacos-group
License : Apache License 2.0
Project Creator : nacos-group
@Override
protected String buildInjectedObjectCacheKey(AnnotationAttributes attributes, Object bean, String beanName, Clreplaced<?> injectedType, InjectionMetadata.InjectedElement injectedElement) {
return bean.getClreplaced().getName() + attributes;
}
18
View Source File : AbstractRecursiveAnnotationVisitor.java
License : MIT License
Project Creator : mindcarver
License : MIT License
Project Creator : mindcarver
/**
* {@link AnnotationVisitor} to recursively visit annotations.
*
* @author Chris Beams
* @author Juergen Hoeller
* @author Phillip Webb
* @author Sam Brannen
* @since 3.1.1
*/
abstract clreplaced AbstractRecursiveAnnotationVisitor extends AnnotationVisitor {
protected final Log logger = LogFactory.getLog(getClreplaced());
protected final AnnotationAttributes attributes;
@Nullable
protected final ClreplacedLoader clreplacedLoader;
public AbstractRecursiveAnnotationVisitor(@Nullable ClreplacedLoader clreplacedLoader, AnnotationAttributes attributes) {
super(SpringAsmInfo.ASM_VERSION);
this.clreplacedLoader = clreplacedLoader;
this.attributes = attributes;
}
@Override
public void visit(String attributeName, Object attributeValue) {
this.attributes.put(attributeName, attributeValue);
}
@Override
public AnnotationVisitor visitAnnotation(String attributeName, String asmTypeDescriptor) {
String annotationType = Type.getType(asmTypeDescriptor).getClreplacedName();
AnnotationAttributes nestedAttributes = new AnnotationAttributes(annotationType, this.clreplacedLoader);
this.attributes.put(attributeName, nestedAttributes);
return new RecursiveAnnotationAttributesVisitor(annotationType, nestedAttributes, this.clreplacedLoader);
}
@Override
public AnnotationVisitor visitArray(String attributeName) {
return new RecursiveAnnotationArrayVisitor(attributeName, this.attributes, this.clreplacedLoader);
}
@Override
public void visitEnum(String attributeName, String asmTypeDescriptor, String attributeValue) {
Object newValue = getEnumValue(asmTypeDescriptor, attributeValue);
visit(attributeName, newValue);
}
protected Object getEnumValue(String asmTypeDescriptor, String attributeValue) {
Object valueToUse = attributeValue;
try {
Clreplaced<?> enumType = ClreplacedUtils.forName(Type.getType(asmTypeDescriptor).getClreplacedName(), this.clreplacedLoader);
Field enumConstant = ReflectionUtils.findField(enumType, attributeValue);
if (enumConstant != null) {
ReflectionUtils.makeAccessible(enumConstant);
valueToUse = enumConstant.get(null);
}
} catch (ClreplacedNotFoundException | NoClreplacedDefFoundError ex) {
logger.debug("Failed to clreplacedload enum type while reading annotation metadata", ex);
} catch (IllegalAccessException | AccessControlException ex) {
logger.debug("Could not access enum value while reading annotation metadata", ex);
}
return valueToUse;
}
}
18
View Source File : EnableMenuImportSelector.java
License : Apache License 2.0
Project Creator : melthaw
License : Apache License 2.0
Project Creator : melthaw
/**
* @author dz
*/
@Configuration
public clreplaced EnableMenuImportSelector implements ImportSelector {
protected AnnotationAttributes enableMenu;
@Override
public String[] selectImports(AnnotationMetadata metadata) {
MultiValueMap<String, Object> attributes = metadata.getAllAnnotationAttributes(EnableMenu.clreplaced.getName(), false);
String pluginId = attributes == null ? null : (String) attributes.getFirst("pluginId");
if (StringUtils.isEmpty(pluginId)) {
return new String[0];
}
return new String[] { MenuPluginBeanRegistrar.clreplaced.getName() };
}
public static clreplaced MenuPluginBeanRegistrar implements ImportBeanDefinitionRegistrar {
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
AnnotationAttributes enableMenu = AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(EnableMenu.clreplaced.getName(), false));
if (enableMenu != null) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DefaultMenuPlugin.clreplaced);
AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
MutablePropertyValues mutablePropertyValues = new MutablePropertyValues();
mutablePropertyValues.add("extensionPointId", enableMenu.getString("extensionPointId"));
mutablePropertyValues.add("pluginId", enableMenu.getString("pluginId"));
mutablePropertyValues.add("menu", toMenu(enableMenu.getAnnotationArray("menu")));
beanDefinition.setPropertyValues(mutablePropertyValues);
registry.registerBeanDefinition("menuPlugin:" + enableMenu.getString("pluginId"), beanDefinition);
}
}
// public MenuPlugin menuPlugin(AnnotationAttributes enableMenu) {
// DefaultMenuPlugin menuPlugin = new DefaultMenuPlugin();
// menuPlugin.setExtensionPointId(enableMenu.getString("extensionPointId"));
// menuPlugin.setPluginId(enableMenu.getString("pluginId"));
// menuPlugin.setMenu(toMenu(enableMenu.getAnnotationArray("menu")));
// return menuPlugin;
// }
private List<in.clouthink.daas.sbb.menu.core.Menu> toMenu(AnnotationAttributes[] menu) {
return Stream.of(menu).map(item -> toMenu(item)).collect(Collectors.toList());
}
private in.clouthink.daas.sbb.menu.core.Menu toMenu(AnnotationAttributes menu) {
in.clouthink.daas.sbb.menu.core.Menu result = new in.clouthink.daas.sbb.menu.core.Menu();
result.setVirtual(menu.getBoolean("virtual"));
result.setOpen(menu.getBoolean("open"));
result.setCode(menu.getString("code"));
result.setName(menu.getString("name"));
result.setOrder(menu.getNumber("order"));
result.setPatterns(Arrays.asList(menu.getStringArray("patterns")));
result.setActions(toAction(menu.getAnnotationArray("actions")));
result.setMetadata(toMetadata(menu.getAnnotationArray("metadata")));
result.setExtensionPoint(toExtensionPoint(menu.getAnnotationArray("extensionPoint")));
return result;
}
private List<Action> toAction(AnnotationAttributes[] actions) {
return Stream.of(actions).map(item -> toAction(item)).collect(Collectors.toList());
}
private Action toAction(AnnotationAttributes action) {
DefaultAction result = new DefaultAction();
result.setCode(action.getString("code"));
result.setName(action.getString("name"));
return result;
}
private Map<String, Object> toMetadata(AnnotationAttributes[] metadatas) {
if (metadatas == null) {
return new HashMap<>();
}
return Stream.of(metadatas).collect(Collectors.toMap(item -> item.getString("key"), item -> {
Metadata.ValueType valueType = item.getEnum("type");
switch(valueType) {
case Boolean:
return item.getBoolean("value");
case Short:
case Integer:
case Long:
return item.getNumber("value");
case BigDecimal:
return new BigDecimal(item.getString("value"));
default:
return item.getString("value");
}
}));
}
private MenuExtensionPoint toExtensionPoint(AnnotationAttributes[] extensionPoints) {
if (extensionPoints == null) {
return null;
}
return Stream.of(extensionPoints).findFirst().map(item -> {
MenuExtensionPoint result = new MenuExtensionPoint();
result.setId(item.getString("id"));
result.setDescription(item.getString("description"));
return result;
}).orElse(null);
}
}
}
18
View Source File : DubboFeignProviderBeanPostProcessor.java
License : Apache License 2.0
Project Creator : matevip
License : Apache License 2.0
Project Creator : matevip
/**
* Generates the bean name of {@link ServiceBean}
*
* @param serviceAnnotationAttributes
* @param interfaceClreplaced the clreplaced of interface annotated {@link Service}
* @return ServiceBean@interfaceClreplacedName#annotatedServiceBeanName
* @since 2.7.3
*/
private String generateServiceBeanName(AnnotationAttributes serviceAnnotationAttributes, Clreplaced<?> interfaceClreplaced) {
ServiceBeanNameBuilder builder = create(interfaceClreplaced, environment).group(serviceAnnotationAttributes.getString("group")).version(serviceAnnotationAttributes.getString("version"));
return builder.build();
}
18
View Source File : SpringTransactionAnnotationParser.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
@Override
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement ae) {
AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(ae, Transactional.clreplaced);
if (attributes != null) {
return parseTransactionAnnotation(attributes);
} else {
return null;
}
}
18
View Source File : JtaTransactionAnnotationParser.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
@Override
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement ae) {
AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(ae, javax.transaction.Transactional.clreplaced);
if (attributes != null) {
return parseTransactionAnnotation(attributes);
} else {
return null;
}
}
18
View Source File : MethodMetadataReadingVisitor.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
@Override
public AnnotationAttributes getAnnotationAttributes(String annotationName, boolean clreplacedValuesreplacedtring) {
AnnotationAttributes raw = AnnotationReadingVisitorUtils.getMergedAnnotationAttributes(this.attributesMap, this.metaAnnotationMap, annotationName);
return AnnotationReadingVisitorUtils.convertClreplacedValues(this.clreplacedLoader, raw, clreplacedValuesreplacedtring);
}
See More Examples