インタフェース JsonHub
- すべてのスーパーインタフェース:
java.lang.Iterable<JsonHub>
public interface JsonHub extends java.lang.Iterable<JsonHub>
- To convert from JSON-String to JsonHub instance,
fromJson(CharSequence)orfromJson(Reader). - To convert from JSON-File to JsonHub instance,
fromFile(Path). - To convert from JSON-bytes to JsonHub instance,
fromBytes(byte[])orfromBytes(InputStream). - To convert from POJO(Plain-Old-Java-Object) to JsonHub instance,
fromPojo(Object). - To get JSON-String from JsonHub instance,
toJson(). - To write JSON-File from JsonHub instance,
writeFile(Path)orwriteFile(Path, OpenOption...). - To get JSON-String-UTF8-bytes from JsonHub instance,
getBytes(). - To convert from JsonHub instance to POJO,
toPojo(Class).
- Methods for seek value in OBJECT or ARRAY,
- Methods for get value,
- Methods for check value,
- To build JsonHub,
getBuilder(), and build.
-
メソッドの概要
修飾子とタイプ メソッド 説明 default booleanbooleanValue()Returns boolean value if type is TRUE or FALSE.booleancontainsKey(java.lang.CharSequence name)Returns true if contains name in Object.default doubledoubleValue()Returns double value if type is NUMBER.voidforEach(java.util.function.BiConsumer<? super JsonString,? super JsonHub> action)forEach operation if type is OBJECT or ARRAY.voidforEach(java.util.function.Consumer<? super JsonHub> action)forEach operation if type is OBJECT or ARRAY.static JsonHubfromBytes(byte[] bs)Returns parsed JsonHub instance from JSON-UTF8-bytes-array.static JsonHubfromBytes(java.io.InputStream strm)Returns parsed JsonHub instance from JSON-UTF8-bytes-stream.static JsonHubfromFile(java.nio.file.Path path)Returns parsed JsonHub instance from read file.static JsonHubfromJson(java.io.Reader reader)Returns parsed JaonHub from Reader.static JsonHubfromJson(java.lang.CharSequence json)Returns JsonHub instance parsing from JSON-String.static JsonHubfromPojo(java.lang.Object pojo)Returns JsonHub instance parsing from POJO (Plain-Old-Java-Object).JsonHubget(int index)Returns value in Array by index.JsonHubget(java.lang.CharSequence name)Returns JsonHub OBJECT-value instance if Object has same-name, and null otherwise.JsonHubget(java.lang.String... names)Returns JsonHub instance, seek chains in Object by names, If seek failed, returnnull.static JsonHubBuildergetBuilder()Returns JsonHubBuilder.byte[]getBytes()Returns UTF-8 encorded bytes.byte[]getBytesExcludedNullValueInObject()Returns UTF-8 encorded bytes excluded null value in Object.JsonHubgetOrDefault(java.lang.CharSequence name)Returns JsonHub instance, seek in Object name, if not exist, return empty-ObjectJsonHub.JsonHubgetOrDefault(java.lang.CharSequence name, JsonHub defaultValue)Returns JsonHub instance, seek in Object name, if not exist, returndefaultValue.default intintValue()Returns int value if type is NUMBER.default booleanisArray()Returnstrueif type is ARRAY.default booleanisBoolean()Returnstrueif type is TRUE or FALSE.booleanisEmpty()Returnstrueif empty.default booleanisFalse()Returnstrueif type is FALSE.default booleanisNull()Returnstrueif type is NULL.default booleanisNumber()Returnstrueif type is NUMBER.default booleanisObject()Returnstrueif type is OBJECT.default booleanisString()Returnstrueif type is STRING.default booleanisTrue()Returnstrueif type is TRUE.java.util.Iterator<JsonHub>iterator()Returns iterator if type is OBJECT or ARRAY.default java.util.List<JsonHub>jsonPath(java.lang.CharSequence jsonPath)Parse with JsonPath.java.util.Set<JsonString>keySet()Returns set of Object names.intlength()Returns length if type is STRING or OBJECT or ARRAY.default longlongValue()Returns long value if type is NUMBER.default booleannonNull()Returnstrueif type is not null.java.util.Optional<java.lang.Boolean>optionalBoolean()Returns Optional, Optional has value if type is TRUE or FALSE, andOptional.empty()otherwise.java.util.OptionalDoubleoptionalDouble()Returns OptionalDouble, OptionalDouble has value if type is NUMBER, andOptionalDouble.empty()otherwise.java.util.OptionalIntoptionalInt()Returns OptionalInt, OptionalInt has value if type is NUMBER, andOptionalInt.empty()otherwise.java.util.OptionalLongoptionalLong()Returns OptionalLong, OptionalLong has value if type is NUMBER, andOptionalLong.empty()otherwise.java.util.Optional<java.lang.Number>optionalNubmer()Returns Optional, Optional has value if type is NUMBER, andOptional.empty()otherwise.java.util.Optional<java.lang.String>optionalString()Returns Optional, Optional has value if type is STRING, andOptional.empty()otherwise.default java.lang.StringprettyPrint()Returns default format Pretty-Print-JSON.default java.lang.StringprettyPrint(JsonHubPrettyPrinterConfig config)Returns Pretty-Print-JSON with config format.default voidprettyPrint(java.io.Writer writer)Write default format Pretty-Print-JSON to writerdefault voidprettyPrint(java.io.Writer writer, JsonHubPrettyPrinterConfig config)Write Pretty-Print-JSON to writer with config formatdefault voidprettyPrint(java.nio.file.Path path)Write default format Pretty-Print-JSON to Filedefault voidprettyPrint(java.nio.file.Path path, JsonHubPrettyPrinterConfig config)Write Pretty-Print-JSON to File with config formatdefault voidprettyPrint(java.nio.file.Path path, JsonHubPrettyPrinterConfig config, java.nio.file.OpenOption... options)Write Pretty-Print-JSON to File with config formatdefault voidprettyPrint(java.nio.file.Path path, java.nio.file.OpenOption... options)Write default format Pretty-Print-JSON to Filejava.util.Spliterator<JsonHub>spliterator()Returns spliterator if type is OBJECT or ARRAY.java.util.stream.Stream<JsonHub>stream()Returns java.util.stream.Stream if type is OBJECT or ARRAY.java.lang.StringtoJson()Returns parsed compact-JSON-StringvoidtoJson(java.io.Writer writer)Write compact-JSON-String to Writerjava.lang.StringtoJsonExcludedNullValueInObject()Returns parsed compact-JSON-String exclude null value pair in Object;voidtoJsonExcludedNullValueInObject(java.io.Writer writer)Returns parsed compact-JSON-String exclude null value pair in Object;default <T> TtoPojo(java.lang.Class<T> classOfT)Returns parsed instance of ClassOtT.JsonHubTypetype()Returns type, type is NULL, TRUE, FALSE, NUMBER, STRING, ARRAY or OBJECT.java.util.List<JsonHub>values()Returns list of values.voidwriteBytes(java.io.OutputStream strm)Write UTF-8 encorded bytes to OutputStreamvoidwriteBytesExcludedNullValueInObject(java.io.OutputStream strm)Write UTF-8 encorded bytes exclued null value in Object to OutputStreamdefault voidwriteFile(java.nio.file.Path path)Write to file.default voidwriteFile(java.nio.file.Path path, java.nio.file.OpenOption... options)Write to file with options.
-
メソッドの詳細
-
iterator
java.util.Iterator<JsonHub> iterator()Returns iterator if type is OBJECT or ARRAY.Available if type is ARRAY or OBJECT.
If type is OBJECT, values is JsonHub.
- 定義:
iteratorインタフェース内java.lang.Iterable<JsonHub>- 例外:
JsonHubUnsupportedOperationException- if type is not (OBJECT or ARRAY)
-
spliterator
java.util.Spliterator<JsonHub> spliterator()Returns spliterator if type is OBJECT or ARRAY.Available if type is ARRAY or OBJECT.
If type is OBJECT, value is JsonHub.
- 定義:
spliteratorインタフェース内java.lang.Iterable<JsonHub>- 例外:
JsonHubUnsupportedOperationException- if type is not (OBJECT or ARRAY)
-
forEach
forEach operation if type is OBJECT or ARRAY.Available if type is OBJECT or ARRAY.
If type is OBJECT, value is JsonHub.
- 定義:
forEachインタフェース内java.lang.Iterable<JsonHub>- パラメータ:
action- Consumer- 例外:
JsonHubUnsupportedOperationException- if type is not (OBJECT or ARRAY)
-
forEach
forEach operation if type is OBJECT or ARRAY.Available if type is OBJECT or ARRAY.
If type is ARRAY, NAME is null.
- パラメータ:
action- the BiConsumer- 例外:
JsonHubUnsupportedOperationException- if type is not (OBJECT or ARRAY)
-
type
JsonHubType type()Returns type, type is NULL, TRUE, FALSE, NUMBER, STRING, ARRAY or OBJECT.- 戻り値:
- JsonHubType
-
stream
java.util.stream.Stream<JsonHub> stream()Returns java.util.stream.Stream if type is OBJECT or ARRAY.Available if type is OBJECT or ARRAY.
If type is OBJECT, value is JsonHub.
- 戻り値:
- Array values stream
- 例外:
JsonHubUnsupportedOperationException- if type is not (OBJECT or ARRAY)
-
keySet
java.util.Set<JsonString> keySet()Returns set of Object names.Available if type is OBJECT.
- 戻り値:
- set of Object names
- 例外:
JsonHubUnsupportedOperationException- if type is not OBJECT
-
values
java.util.List<JsonHub> values()Returns list of values.Available if type is OBJECT or ARRAY.
- 戻り値:
- list of values
- 例外:
JsonHubUnsupportedOperationException- if type is not (OBJECT or ARRAY)
-
get
Returns value in Array by index.Available if type is ARRAY.
- パラメータ:
index- index of Array- 戻り値:
- value
- 例外:
JsonHubUnsupportedOperationException- if type is not ARRAY
-
containsKey
boolean containsKey(java.lang.CharSequence name)Returns true if contains name in Object.Available if type is OBJECT.
Not acceptnull.
- パラメータ:
name- name of Object- 戻り値:
- true if contains name in Object
- 例外:
JsonHubUnsupportedOperationException- if type is not OBJECT
-
get
Returns JsonHub OBJECT-value instance if Object has same-name, and null otherwise.Available if type is OBJECT.
Not acceptnull.
- パラメータ:
name- name of Object- 戻り値:
- JsonHub value. null if has no same name.
- 例外:
JsonHubUnsupportedOperationException- if type is not OBJECT
-
getOrDefault
Returns JsonHub instance, seek in Object name, if not exist, return empty-ObjectJsonHub.Available if type is OBJECT
- パラメータ:
name- name of Object- 戻り値:
- value, Empty-ObjectJsonHub instance if not exist
- 例外:
JsonHubUnsupportedOperationException- if type is not OBJECT
-
getOrDefault
Returns JsonHub instance, seek in Object name, if not exist, returndefaultValue.Available if type is OBJECT
- パラメータ:
name- name of ObjectdefaultValue- return this value if not exist.- 戻り値:
- value, defaultValue if not exist
- 例外:
JsonHubUnsupportedOperationException- if type is not OBJECT
-
get
Returns JsonHub instance, seek chains in Object by names, If seek failed, returnnull.Available if type is OBJECT-chains
- パラメータ:
names- names of Object- 戻り値:
- value if exist and null otherwise
- 例外:
JsonHubUnsupportedOperationException- if type is not OBJECT
-
length
int length()Returns length if type is STRING or OBJECT or ARRAY.Available if type is STRING or ARRAY or OBJECT
If type is STRING return length of String.
If type is ARRAY, return size of values.
If type is OBJECT, return size of name-value-pairs.
- 戻り値:
- length
- 例外:
JsonHubUnsupportedOperationException- if not (STRING or ARRAY or OBJECT)
-
isEmpty
boolean isEmpty()Returnstrueif empty.Available if type is STRING or ARRAY or OBJECT.
If type is STRING, return
trueif length is 0.
If type is ARRAY, returntrueif Array is empty.
If type is OBJECT, returntrueif Object-pairs is empty.
- 戻り値:
trueif empty- 例外:
JsonHubUnsupportedOperationException- if not (STRING or ARRAY or OBJECT)
-
isNull
default boolean isNull()Returnstrueif type is NULL.- 戻り値:
trueif type is NULL
-
nonNull
default boolean nonNull()Returnstrueif type is not null.- 戻り値:
trueif type is not NULL
-
isTrue
default boolean isTrue()Returnstrueif type is TRUE.- 戻り値:
trueif type is TRUE
-
isFalse
default boolean isFalse()Returnstrueif type is FALSE.- 戻り値:
trueif type is FALSE
-
isBoolean
default boolean isBoolean()Returnstrueif type is TRUE or FALSE.- 戻り値:
trueif type is TRUE or FALSE
-
isString
default boolean isString()Returnstrueif type is STRING.- 戻り値:
trueis type is STRING
-
isNumber
default boolean isNumber()Returnstrueif type is NUMBER.- 戻り値:
trueif type is NUMBER
-
isArray
default boolean isArray()Returnstrueif type is ARRAY.- 戻り値:
trueif type is ARRAY
-
isObject
default boolean isObject()Returnstrueif type is OBJECT.- 戻り値:
trueif type is OBJECT
-
optionalBoolean
java.util.Optional<java.lang.Boolean> optionalBoolean()Returns Optional, Optional has value if type is TRUE or FALSE, andOptional.empty()otherwise.- 戻り値:
- Optional has value if type is TRUE or FALSE, and
Optional.empty()otherwise
-
optionalInt
java.util.OptionalInt optionalInt()Returns OptionalInt, OptionalInt has value if type is NUMBER, andOptionalInt.empty()otherwise.- 戻り値:
- OptionalInt has value if type is NUMBER, and
OptionalInt.empty()otherwise
-
optionalLong
java.util.OptionalLong optionalLong()Returns OptionalLong, OptionalLong has value if type is NUMBER, andOptionalLong.empty()otherwise.- 戻り値:
- OptionalLong has value if type is NUMBER, and
OptionalLong.empty()otherwise
-
optionalDouble
java.util.OptionalDouble optionalDouble()Returns OptionalDouble, OptionalDouble has value if type is NUMBER, andOptionalDouble.empty()otherwise.- 戻り値:
- OptionalDouble has value if type is NUMBER, and
OptionalDouble.empty()otherwise
-
optionalString
java.util.Optional<java.lang.String> optionalString()Returns Optional, Optional has value if type is STRING, andOptional.empty()otherwise.- 戻り値:
- Optional has value if type is STRING, and
Optional.empty()otherwise
-
optionalNubmer
java.util.Optional<java.lang.Number> optionalNubmer()Returns Optional, Optional has value if type is NUMBER, andOptional.empty()otherwise.- 戻り値:
- Optional has value if type is NUMBER, and
Optional.empty()otherwise
-
booleanValue
default boolean booleanValue()Returns boolean value if type is TRUE or FALSE.Available if type is TRUE or FALSE
- 戻り値:
- booleanValue
- 例外:
JsonHubUnsupportedOperationException- if type is not (TRUE or FALSE)
-
intValue
default int intValue()Returns int value if type is NUMBER.Available if type is NUMBER.
- 戻り値:
- intValue
- 例外:
JsonHubUnsupportedOperationException- if type is not NUMBER
-
longValue
default long longValue()Returns long value if type is NUMBER.Available if type is NUMBER.
- 戻り値:
- longValue
- 例外:
JsonHubUnsupportedOperationException- if type is not NUMBER
-
doubleValue
default double doubleValue()Returns double value if type is NUMBER.Available if type is NUMBER.
- 戻り値:
- doubleValue
- 例外:
JsonHubUnsupportedOperationException- if type is not NUMBER
-
getBuilder
Returns JsonHubBuilder.- 戻り値:
- JsonHubBuilder instance
- 関連項目:
JsonHubBuilder
-
fromJson
Returns JsonHub instance parsing from JSON-String.Not accept
null.
- パラメータ:
json- JSON-string- 戻り値:
- parsed JsonHub instance
- 例外:
JsonHubParseException- if parse failed
-
fromJson
Returns parsed JaonHub from Reader.- パラメータ:
reader- the reader- 戻り値:
- parsed JsonHub instance
- 例外:
java.io.IOException- if IO failedJsonHubParseException- if parse failed
-
toJson
java.lang.String toJson()Returns parsed compact-JSON-String- 戻り値:
- json
-
toJson
void toJson(java.io.Writer writer) throws java.io.IOExceptionWrite compact-JSON-String to Writer- パラメータ:
writer- writer of JSON-string- 例外:
java.io.IOException- if IO failed
-
toJsonExcludedNullValueInObject
java.lang.String toJsonExcludedNullValueInObject()Returns parsed compact-JSON-String exclude null value pair in Object;- 戻り値:
- json of excluded null value pair in Object.
-
toJsonExcludedNullValueInObject
void toJsonExcludedNullValueInObject(java.io.Writer writer) throws java.io.IOExceptionReturns parsed compact-JSON-String exclude null value pair in Object;- パラメータ:
writer- the writer- 例外:
java.io.IOException- if IO failed
-
fromFile
Returns parsed JsonHub instance from read file.- パラメータ:
path- of JSON file- 戻り値:
- parsed JsonHub instance
- 例外:
java.io.IOException- if IO failedJsonHubParseException- if JsonHub parse failed
-
writeFile
default void writeFile(java.nio.file.Path path) throws java.io.IOExceptionWrite to file.- パラメータ:
path- File-path- 例外:
java.io.IOException- if IO failed
-
writeFile
default void writeFile(java.nio.file.Path path, java.nio.file.OpenOption... options) throws java.io.IOExceptionWrite to file with options.- パラメータ:
path- File-pathoptions- file open options.- 例外:
java.io.IOException- if IO failed
-
prettyPrint
default java.lang.String prettyPrint()Returns default format Pretty-Print-JSON.- 戻り値:
- default format Pretty-Print-JSON
- 関連項目:
JsonHubPrettyPrinter
-
prettyPrint
Returns Pretty-Print-JSON with config format.- パラメータ:
config- config of Pretty-Print-Format- 戻り値:
- Pretty-Print-JSON with config format
- 関連項目:
JsonHubPrettyPrinter
-
prettyPrint
default void prettyPrint(java.io.Writer writer) throws java.io.IOExceptionWrite default format Pretty-Print-JSON to writer- パラメータ:
writer- writer of JSON-string- 例外:
java.io.IOException- if IO failed- 関連項目:
JsonHubPrettyPrinter
-
prettyPrint
default void prettyPrint(java.io.Writer writer, JsonHubPrettyPrinterConfig config) throws java.io.IOExceptionWrite Pretty-Print-JSON to writer with config format- パラメータ:
writer- writer of JSON-stringconfig- config of Pretty-Print-Format- 例外:
java.io.IOException- if IO failed- 関連項目:
JsonHubPrettyPrinter
-
prettyPrint
default void prettyPrint(java.nio.file.Path path) throws java.io.IOExceptionWrite default format Pretty-Print-JSON to File- パラメータ:
path- File-Path- 例外:
java.io.IOException- if IO failed- 関連項目:
JsonHubPrettyPrinter
-
prettyPrint
default void prettyPrint(java.nio.file.Path path, java.nio.file.OpenOption... options) throws java.io.IOExceptionWrite default format Pretty-Print-JSON to File- パラメータ:
path- File-Pathoptions- OpenOptions- 例外:
java.io.IOException- if IO failed- 関連項目:
JsonHubPrettyPrinter
-
prettyPrint
default void prettyPrint(java.nio.file.Path path, JsonHubPrettyPrinterConfig config) throws java.io.IOExceptionWrite Pretty-Print-JSON to File with config format- パラメータ:
path- File-Pathconfig- config of Pretty-Print-Format- 例外:
java.io.IOException- if IO failed- 関連項目:
JsonHubPrettyPrinter
-
prettyPrint
default void prettyPrint(java.nio.file.Path path, JsonHubPrettyPrinterConfig config, java.nio.file.OpenOption... options) throws java.io.IOExceptionWrite Pretty-Print-JSON to File with config format- パラメータ:
path- File-Pathconfig- config of Pretty-Print-Formatoptions- OpenOptions- 例外:
java.io.IOException- if IO failed- 関連項目:
JsonHubPrettyPrinter
-
fromPojo
Returns JsonHub instance parsing from POJO (Plain-Old-Java-Object).- パラメータ:
pojo- (Plain-Old-Java-Object)- 戻り値:
- parsed JsonHub instance
- 例外:
JsonHubParseException- if parse failed
-
toPojo
default <T> T toPojo(java.lang.Class<T> classOfT)Returns parsed instance of ClassOtT.- 型パラメータ:
T- Type- パラメータ:
classOfT- Class of Type- 戻り値:
- parsed POJO instance
- 例外:
JsonHubParseException- if parse failed
-
getBytes
byte[] getBytes()Returns UTF-8 encorded bytes.- 戻り値:
- UTF-8 encorded bytes
-
writeBytes
void writeBytes(java.io.OutputStream strm) throws java.io.IOExceptionWrite UTF-8 encorded bytes to OutputStream- パラメータ:
strm- OutputStream- 例外:
java.io.IOException- if IO failed
-
getBytesExcludedNullValueInObject
byte[] getBytesExcludedNullValueInObject()Returns UTF-8 encorded bytes excluded null value in Object.- 戻り値:
- UTF-8 encorded bytes excluded null value in Object
-
writeBytesExcludedNullValueInObject
void writeBytesExcludedNullValueInObject(java.io.OutputStream strm) throws java.io.IOExceptionWrite UTF-8 encorded bytes exclued null value in Object to OutputStream- パラメータ:
strm- OutputStream- 例外:
java.io.IOException- if IO failed
-
fromBytes
Returns parsed JsonHub instance from JSON-UTF8-bytes-array.- パラメータ:
bs- JSON-UTF8-bytes-array- 戻り値:
- parsed JsonHub instance
- 例外:
JsonHubParseException- if parse failed
-
fromBytes
Returns parsed JsonHub instance from JSON-UTF8-bytes-stream.- パラメータ:
strm- JSON-UTF8-bytes-stream- 戻り値:
- parsed JsonHub instance
- 例外:
java.io.IOException- if IO failedJsonHubParseException- if parse failed
-
jsonPath
Parse with JsonPath.- パラメータ:
jsonPath- the JsonPath- 戻り値:
- List of JsonHub
-