本文整理汇总了Java中org.springframework.boot.configurationprocessor.metadata.ItemHint类的典型用法代码示例。如果您正苦于以下问题:Java ItemHint类的具体用法?Java ItemHint怎么用?Java ItemHint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItemHint类属于org.springframework.boot.configurationprocessor.metadata包,在下文中一共展示了ItemHint类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: matches
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
@Override
public boolean matches(ItemHint hint) {
if (this.index + 1 > hint.getProviders().size()) {
return false;
}
ItemHint.ValueProvider valueProvider = hint.getProviders().get(this.index);
if (this.name != null && !this.name.equals(valueProvider.getName())) {
return false;
}
if (this.parameters != null) {
for (Map.Entry<String, Object> entry : this.parameters.entrySet()) {
if (!IsMapContaining.hasEntry(entry.getKey(), entry.getValue())
.matches(valueProvider.getParameters())) {
return false;
}
}
}
return true;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:20,代码来源:Metadata.java
示例2: mergingOfHintWithProvider
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
@Test
public void mergingOfHintWithProvider() throws Exception {
writeAdditionalHints(new ItemHint("simple.theName",
Collections.<ItemHint.ValueHint>emptyList(),
Arrays.asList(
new ItemHint.ValueProvider("first",
Collections.<String, Object>singletonMap("target",
"org.foo")),
new ItemHint.ValueProvider("second", null))));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue("boot").withDeprecation(null, null));
assertThat(metadata).has(Metadata.withHint("simple.the-name")
.withProvider("first", "target", "org.foo").withProvider("second"));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例3: mergingOfHintWithProvider
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
@Test
public void mergingOfHintWithProvider() throws Exception {
writeAdditionalHints(new ItemHint("simple.theName",
Collections.<ItemHint.ValueHint>emptyList(),
Arrays.asList(
new ItemHint.ValueProvider("first",
Collections.<String, Object>singletonMap("target",
"org.foo")),
new ItemHint.ValueProvider("second", null))));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata,
containsProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue(is("boot")).withDeprecation(null, null));
assertThat(metadata, containsHint("simple.the-name")
.withProvider("first", "target", "org.foo").withProvider("second"));
}
示例4: matches
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
@Override
public boolean matches(Object item) {
ConfigurationMetadata metadata = (ConfigurationMetadata) item;
ItemHint itemHint = getFirstHintWithName(metadata, this.name);
if (itemHint == null) {
return false;
}
for (ValueHintMatcher value : this.values) {
if (!value.matches(itemHint)) {
return false;
}
}
for (ValueProviderMatcher provider : this.providers) {
if (!provider.matches(itemHint)) {
return false;
}
}
return true;
}
示例5: getFirstHintWithName
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
private ItemHint getFirstHintWithName(ConfigurationMetadata metadata,
String name) {
for (ItemHint hint : metadata.getHints()) {
if (name.equals(hint.getName())) {
return hint;
}
}
return null;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:Metadata.java
示例6: mergingOfSimpleHint
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
@Test
public void mergingOfSimpleHint() throws Exception {
writeAdditionalHints(ItemHint.newHint("simple.the-name",
new ItemHint.ValueHint("boot", "Bla bla"),
new ItemHint.ValueHint("spring", null)));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue("boot").withDeprecation(null, null));
assertThat(metadata).has(Metadata.withHint("simple.the-name")
.withValue(0, "boot", "Bla bla").withValue(1, "spring", null));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例7: mergingOfHintWithNonCanonicalName
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
@Test
public void mergingOfHintWithNonCanonicalName() throws Exception {
writeAdditionalHints(ItemHint.newHint("simple.theName",
new ItemHint.ValueHint("boot", "Bla bla")));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue("boot").withDeprecation(null, null));
assertThat(metadata).has(
Metadata.withHint("simple.the-name").withValue(0, "boot", "Bla bla"));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:ConfigurationMetadataAnnotationProcessorTests.java
示例8: mergingOfSimpleHint
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
@Test
public void mergingOfSimpleHint() throws Exception {
writeAdditionalHints(ItemHint.newHint("simple.the-name",
new ItemHint.ValueHint("boot", "Bla bla"),
new ItemHint.ValueHint("spring", null)));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata,
containsProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue(is("boot")).withDeprecation(null, null));
assertThat(metadata, containsHint("simple.the-name")
.withValue(0, "boot", "Bla bla").withValue(1, "spring", null));
}
示例9: mergingOfHintWithNonCanonicalName
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
@Test
public void mergingOfHintWithNonCanonicalName() throws Exception {
writeAdditionalHints(ItemHint.newHint("simple.theName",
new ItemHint.ValueHint("boot", "Bla bla")));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata,
containsProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue(is("boot")).withDeprecation(null, null));
assertThat(metadata,
containsHint("simple.the-name").withValue(0, "boot", "Bla bla"));
}
示例10: describeMismatch
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
@Override
public void describeMismatch(Object item, Description description) {
ConfigurationMetadata metadata = (ConfigurationMetadata) item;
ItemHint itemHint = getFirstHintWithName(metadata, this.name);
if (itemHint == null) {
description.appendText("missing hint " + this.name);
}
else {
description.appendText("was hint ").appendValue(itemHint);
}
}
示例11: writeAdditionalHints
import org.springframework.boot.configurationprocessor.metadata.ItemHint; //导入依赖的package包/类
private void writeAdditionalHints(ItemHint... hints) throws IOException {
File additionalMetadataFile = createAdditionalMetadataFile();
JSONObject additionalMetadata = new JSONObject();
additionalMetadata.put("hints", hints);
writeMetadata(additionalMetadataFile, additionalMetadata);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:ConfigurationMetadataAnnotationProcessorTests.java