当前位置: 首页>>代码示例>>Java>>正文


Java ValueHint类代码示例

本文整理汇总了Java中org.springframework.boot.configurationmetadata.ValueHint的典型用法代码示例。如果您正苦于以下问题:Java ValueHint类的具体用法?Java ValueHint怎么用?Java ValueHint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ValueHint类属于org.springframework.boot.configurationmetadata包,在下文中一共展示了ValueHint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryHintMetadata

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
@Override
public List<ValueHint> queryHintMetadata(String propertyName, String filter) {
    if (cpExec == null) {
        init();
    }
    List<ValueHint> ret = new LinkedList<>();
    ConfigurationMetadataProperty cfgMeta = getPropertyMetadata(propertyName);
    if (cfgMeta != null) {
        for (ValueHint valueHint : cfgMeta.getHints().getValueHints()) {
            if (filter == null || valueHint.getValue().toString().contains(filter)) {
                ret.add(valueHint);
            }
        }
    }
    return ret;
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:17,代码来源:SpringBootServiceImpl.java

示例2: addValueHintsProposals

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
void addValueHintsProposals(final String dsl, AppRegistration appRegistration, final List<CompletionProposal> collector, final String propertyName, final ValueHintProvider[] valueHintProviders){
	final Resource metadataResource = this.appRegistry.getAppMetadataResource(appRegistration);
	if (metadataResource != null) {
		final URLClassLoader classLoader = metadataResolver.createAppClassLoader(metadataResource);
		this.doWithClassLoader(classLoader, () -> {
			CompletionProposal.Factory proposals = expanding(dsl);
			List<ConfigurationMetadataProperty> whiteList = metadataResolver.listProperties(metadataResource);
			for (ConfigurationMetadataProperty property : metadataResolver.listProperties(metadataResource, true)) {
				if (CompletionUtils.isMatchingProperty(propertyName, property, whiteList)) {
					for (ValueHintProvider valueHintProvider : valueHintProviders) {
						for (ValueHint valueHint : valueHintProvider.generateValueHints(property, classLoader)) {
							collector.add(proposals.withSuffix(String.valueOf(valueHint.getValue()),
									valueHint.getShortDescription()));
						}
					}
				}
			}
			return null;
		});
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:22,代码来源:ProposalsCollectorSupportUtils.java

示例3: generateValueHints

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
@Override
public List<ValueHint> generateValueHints(ConfigurationMetadataProperty property, ClassLoader classLoader) {
	List<ValueHint> result = new ArrayList<>();
	if (ClassUtils.isPresent(property.getType(), classLoader)) {
		Class<?> clazz = ClassUtils.resolveClassName(property.getType(), classLoader);
		if (clazz.isEnum()) {
			for (Object o : clazz.getEnumConstants()) {
				ValueHint hint = new ValueHint();
				hint.setValue(o);
				result.add(hint);
			}
		}
	}
	return result;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:16,代码来源:EnumValueHintProvider.java

示例4: completePropValue

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
public void completePropValue(SpringBootService sbs, CompletionResultSet completionResultSet, String propName, String filter,
        int startOffset, int caretOffset) {
    long mark = System.currentTimeMillis();
    logger.log(FINER, "Completing property value: {0}", filter);
    for (ValueHint valueHint : sbs.queryHintMetadata(propName, filter)) {
        completionResultSet.addItem(new CfgPropValueCompletionItem(valueHint, startOffset, caretOffset));
    }
    final long elapsed = System.currentTimeMillis() - mark;
    logger.log(FINER, "Value completion of ''{0}'' on ''{1}'' took: {2} msecs", new Object[]{filter, propName, elapsed});
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:11,代码来源:CfgPropsCompletionProvider.java

示例5: getText

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
@Override
public String getText() {
    ValueHint valueHint = item.getHint();
    StringBuilder sb = new StringBuilder();
    // name and type
    sb.append("<b>").append(valueHint.getValue()).append("</b>");
    final String description = valueHint.getDescription();
    if (description != null) {
        sb.append("<br/>").append(simpleHtmlEscape(description));
    }
    return sb.toString();
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:13,代码来源:CfgPropValueCompletionDocumentation.java

示例6: addAlreadyTypedValueHintsProposals

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
boolean addAlreadyTypedValueHintsProposals(final String text, AppRegistration appRegistration, final List<CompletionProposal> collector, final String propertyName, final ValueHintProvider[] valueHintProviders, final String alreadyTyped){
	final Resource metadataResource = this.appRegistry.getAppMetadataResource(appRegistration);
	if (metadataResource == null) {
		return false;
	}
	final URLClassLoader classLoader = metadataResolver.createAppClassLoader(metadataResource);
	return this.doWithClassLoader(classLoader, () -> {
		CompletionProposal.Factory proposals = expanding(text);
		List<ConfigurationMetadataProperty> allProps = metadataResolver.listProperties(metadataResource, true);
		List<ConfigurationMetadataProperty> whiteListedProps = metadataResolver.listProperties(metadataResource);
		for (ConfigurationMetadataProperty property : allProps) {
			if (CompletionUtils.isMatchingProperty(propertyName, property, whiteListedProps)) {
				for (ValueHintProvider valueHintProvider : valueHintProviders) {
					List<ValueHint> valueHints = valueHintProvider.generateValueHints(property, classLoader);
					if (!valueHints.isEmpty() && valueHintProvider.isExclusive(property)) {
						collector.clear();
					}
					for (ValueHint valueHint : valueHints) {
						String candidate = String.valueOf(valueHint.getValue());
						if (!candidate.equals(alreadyTyped) && candidate.startsWith(alreadyTyped)) {
							collector.add(proposals.withSuffix(candidate.substring(alreadyTyped.length()),
									valueHint.getShortDescription()));
						}
					}
					if (!valueHints.isEmpty() && valueHintProvider.isExclusive(property)) {
						return true;
					}
				}
			}
		}
		return false;
	});
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:34,代码来源:ProposalsCollectorSupportUtils.java

示例7: generateValueHints

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
@Override
public List<ValueHint> generateValueHints(ConfigurationMetadataProperty property, ClassLoader classLoader) {
	return property.getValueHints();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:5,代码来源:DefaultValueHintProvider.java

示例8: generateValueHints

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
@Override
public List<ValueHint> generateValueHints(ConfigurationMetadataProperty property, ClassLoader classLoader) {
	return "java.lang.Boolean".equals(property.getType())
			? BOOLEANS
			: Collections.<ValueHint>emptyList();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:7,代码来源:BooleanValueHintProvider.java

示例9: CfgPropValueCompletionItem

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
public CfgPropValueCompletionItem(ValueHint hint, int dotOffset, int caretOffset) {
    this.hint = hint;
    this.dotOffset = dotOffset;
    this.caretOffset = caretOffset;
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:6,代码来源:CfgPropValueCompletionItem.java

示例10: getHint

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
public ValueHint getHint() {
    return hint;
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:4,代码来源:CfgPropValueCompletionItem.java

示例11: getText

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
@Override
public String getText() {
    ConfigurationMetadataProperty configurationMeta = item.getConfigurationMetadata();
    StringBuilder sb = new StringBuilder();
    // name and type
    sb.append("<b>").append(configurationMeta.getId()).append("</b>");
    sb.append("<br/>").append(simpleHtmlEscape(configurationMeta.getType()));
    // deprecation (optional)
    Deprecation deprecation = configurationMeta.getDeprecation();
    if (deprecation != null) {
        sb.append("<br/><br/><b><i>");
        if (Utils.isErrorDeprecated(configurationMeta)) {
            sb.append("REMOVED");
        } else {
            sb.append("Deprecated");
        }
        // deprecation reason if present
        String reason = deprecation.getReason();
        if (reason != null) {
            sb.append(":</i></b> ").append(simpleHtmlEscape(reason));
        } else {
            sb.append("</i></b>");
        }
        String replacement = deprecation.getReplacement();
        if (replacement != null) {
            sb.append("<br/><i>Replaced by:</i> <code>").append(replacement).append("</code>");
        }
    }
    // default value (optional)
    final Object defaultValue = configurationMeta.getDefaultValue();
    if (null != defaultValue) {
        sb.append("<br/><br/><i>Default:</i> ");
        if (defaultValue instanceof Object[]) {
            sb.append(Arrays.toString((Object[]) defaultValue));
        } else {
            sb.append(String.valueOf(defaultValue));
        }
    }
    // description (optional)
    final String description = configurationMeta.getDescription();
    if (description != null) {
        sb.append("<br/><br/>").append(description);
    }
    // list of values (optional)
    Hints hints = configurationMeta.getHints();
    List<ValueHint> valueHints = hints.getValueHints();
    if (valueHints != null && !valueHints.isEmpty()) {
        sb.append("<br/><br/><table><tr><td><i>Value</i></td><td><i>Description</i></td></tr>");
        for (ValueHint vHint : valueHints) {
            sb.append("<tr><td>").append(vHint.getValue()).append("</td><td>");
            final String vDesc = vHint.getDescription();
            if (vDesc != null) {
                sb.append(simpleHtmlEscape(vDesc)).append("</th></tr>");
            }
        }
        sb.append("</table>");
    }
    return sb.toString();
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:60,代码来源:CfgPropCompletionDocumentation.java

示例12: generateValueHints

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
@Override
public List<ValueHint> generateValueHints(ConfigurationMetadataProperty property, ClassLoader classLoader) {
	return property.getHints().getValueHints();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:5,代码来源:DefaultValueHintProvider.java

示例13: generateValueHints

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
@Override
public List<ValueHint> generateValueHints(ConfigurationMetadataProperty property, ClassLoader classLoader) {
	return "java.lang.Boolean".equals(property.getType()) ? BOOLEANS : Collections.<ValueHint>emptyList();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:5,代码来源:BooleanValueHintProvider.java

示例14: generateValueHints

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
/**
 * For a given property, return a list of {@link ValueHint} that may apply.
 *
 * @param property     property for which to generate value hints
 * @param classLoader  class loader for the artifact/module that this
 * property applies to; this may be used to load other classes/resources
 * for generating value hints
 * @return list of value hints for the provided property
 */
List<ValueHint> generateValueHints(ConfigurationMetadataProperty property, ClassLoader classLoader);
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:11,代码来源:ValueHintProvider.java

示例15: generateValueHints

import org.springframework.boot.configurationmetadata.ValueHint; //导入依赖的package包/类
/**
 * For a given property, return a list of {@link ValueHint} that may apply.
 *
 * @param property property for which to generate value hints
 * @param classLoader class loader for the artifact/module that this property applies
 * to; this may be used to load other classes/resources for generating value hints
 * @return list of value hints for the provided property
 */
List<ValueHint> generateValueHints(ConfigurationMetadataProperty property, ClassLoader classLoader);
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:10,代码来源:ValueHintProvider.java


注:本文中的org.springframework.boot.configurationmetadata.ValueHint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。