Skip to content

Commit 281ee60

Browse files
committed
Add adapter for real Value interface
1 parent 3c69653 commit 281ee60

3 files changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package io.jooby.spi;
2+
3+
import javax.annotation.Nonnull;
4+
import javax.annotation.Nullable;
5+
6+
public interface ValueContainer {
7+
8+
/**
9+
* Get a value at the given position.
10+
*
11+
* @param index Position.
12+
* @return A value at the given position.
13+
*/
14+
@Nonnull ValueContainer get(@Nonnull int index);
15+
16+
/**
17+
* Get a value that matches the given name.
18+
*
19+
* @param name Field name.
20+
* @return Field value.
21+
*/
22+
@Nonnull ValueContainer get(@Nonnull String name);
23+
24+
@Nonnull String value();
25+
26+
@Nullable String valueOrNull();
27+
28+
/**
29+
* True for missing values.
30+
*
31+
* @return True for missing values.
32+
*/
33+
boolean isMissing();
34+
35+
/**
36+
* The number of values this one has. For single values size is <code>0</code>.
37+
*
38+
* @return Number of values. Mainly for array and hash values.
39+
*/
40+
int size();
41+
42+
/**
43+
* True if this value is an array/sequence (not single or hash).
44+
*
45+
* @return True if this value is an array/sequence.
46+
*/
47+
boolean isArray();
48+
49+
/**
50+
* True if this is a single value (not a hash or array).
51+
*
52+
* @return True if this is a single value (not a hash or array).
53+
*/
54+
boolean isSingle();
55+
56+
/**
57+
* True if this is a hash/object value (not single or array).
58+
*
59+
* @return True if this is a hash/object value (not single or array).
60+
*/
61+
boolean isObject();
62+
63+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package io.jooby.spi;
2+
3+
4+
public interface ValueConverter {
5+
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package io.jooby.spi;
2+
3+
4+
public class ValueConverters {
5+
6+
}

0 commit comments

Comments
 (0)