DBZ-576 Internal parameters
This commit is contained in:
parent
a77c8d733a
commit
3740aee4e8
@ -46,6 +46,9 @@
|
|||||||
*/
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
public final class Field {
|
public final class Field {
|
||||||
|
|
||||||
|
public static final String INTERNAL_PREFIX = "internal.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a set of fields.
|
* Create a set of fields.
|
||||||
*
|
*
|
||||||
@ -237,6 +240,17 @@ public static Field create(String name) {
|
|||||||
return new Field(name, null, null, null, null, null, null, null);
|
return new Field(name, null, null, null, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an immutable internal {@link Field} instance with the given property name.
|
||||||
|
* The name will be prefixed with {@code internal.} prefix.
|
||||||
|
*
|
||||||
|
* @param name the name of the field; may not be null
|
||||||
|
* @return the field; never null
|
||||||
|
*/
|
||||||
|
public static Field createInternal(String name) {
|
||||||
|
return new Field(INTERNAL_PREFIX + name, null, null, null, null, null, null, null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an immutable {@link Field} instance with the given property name.
|
* Create an immutable {@link Field} instance with the given property name.
|
||||||
*
|
*
|
||||||
|
@ -49,6 +49,12 @@ public void shouldConvertFromProperties() {
|
|||||||
assertThat(config.getBoolean("1")).isNull(); // not a boolean
|
assertThat(config.getBoolean("1")).isNull(); // not a boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shoulCreateInternalFields() {
|
||||||
|
config = Configuration.create().with(Field.createInternal("a"), "a1").build();
|
||||||
|
assertThat(config.getString("internal.a")).isEqualTo("a1");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldCallFunctionOnEachMatchingFieldUsingRegex() {
|
public void shouldCallFunctionOnEachMatchingFieldUsingRegex() {
|
||||||
config = Configuration.create()
|
config = Configuration.create()
|
||||||
|
Loading…
Reference in New Issue
Block a user