本文整理了Java中io.micronaut.context.ApplicationContext.containsProperty()
方法的一些代码示例,展示了ApplicationContext.containsProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ApplicationContext.containsProperty()
方法的具体详情如下:
包路径:io.micronaut.context.ApplicationContext
类名称:ApplicationContext
方法名:containsProperty
暂无
代码示例来源:origin: io.micronaut/inject
/**
* Obtains a value for the given field argument.
*
* @param resolutionContext The resolution context
* @param context The bean context
* @param fieldIndex The field index
* @return True if it does
*/
@Internal
@UsedByGeneratedCode
protected final boolean containsValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) {
if (context instanceof ApplicationContext) {
FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex);
final AnnotationMetadata annotationMetadata = injectionPoint.getAnnotationMetadata();
String valueAnnVal = annotationMetadata.getValue(Value.class, String.class).orElse(null);
String valString = resolvePropertyValueName(resolutionContext, injectionPoint, valueAnnVal, annotationMetadata);
ApplicationContext applicationContext = (ApplicationContext) context;
Class fieldType = injectionPoint.getType();
boolean isConfigProps = fieldType.isAnnotationPresent(ConfigurationProperties.class);
boolean result = isConfigProps || Map.class.isAssignableFrom(fieldType) ? applicationContext.containsProperties(valString) : applicationContext.containsProperty(valString);
if (!result && isConfigurationProperties()) {
String cliOption = resolveCliOption(injectionPoint.getName());
if (cliOption != null) {
return applicationContext.containsProperty(cliOption);
}
}
return result;
}
return false;
}
代码示例来源:origin: io.micronaut/micronaut-inject
/**
* Obtains a value for the given field argument.
*
* @param resolutionContext The resolution context
* @param context The bean context
* @param fieldIndex The field index
* @return True if it does
*/
@Internal
@UsedByGeneratedCode
protected final boolean containsValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) {
if (context instanceof ApplicationContext) {
FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex);
final AnnotationMetadata annotationMetadata = injectionPoint.getAnnotationMetadata();
String valueAnnVal = annotationMetadata.getValue(Value.class, String.class).orElse(null);
String valString = resolvePropertyValueName(resolutionContext, injectionPoint, valueAnnVal, annotationMetadata);
ApplicationContext applicationContext = (ApplicationContext) context;
Class fieldType = injectionPoint.getType();
boolean isConfigProps = fieldType.isAnnotationPresent(ConfigurationProperties.class);
boolean result = isConfigProps || Map.class.isAssignableFrom(fieldType) ? applicationContext.containsProperties(valString) : applicationContext.containsProperty(valString);
if (!result && isConfigurationProperties()) {
String cliOption = resolveCliOption(injectionPoint.getName());
if (cliOption != null) {
return applicationContext.containsProperty(cliOption);
}
}
return result;
}
return false;
}
代码示例来源:origin: io.micronaut/inject
Class type = argument.getType();
boolean isConfigProps = type.isAnnotationPresent(ConfigurationProperties.class);
boolean result = isConfigProps || Map.class.isAssignableFrom(type) ? applicationContext.containsProperties(valString) : applicationContext.containsProperty(valString);
if (!result && isConfigurationProperties()) {
String cliOption = resolveCliOption(argument.getName());
if (cliOption != null) {
result = applicationContext.containsProperty(cliOption);
代码示例来源:origin: io.micronaut/micronaut-inject
Class type = argument.getType();
boolean isConfigProps = type.isAnnotationPresent(ConfigurationProperties.class);
boolean result = isConfigProps || Map.class.isAssignableFrom(type) ? applicationContext.containsProperties(valString) : applicationContext.containsProperty(valString);
if (!result && isConfigurationProperties()) {
String cliOption = resolveCliOption(argument.getName());
if (cliOption != null) {
result = applicationContext.containsProperty(cliOption);
内容来源于网络,如有侵权,请联系作者删除!