Package jsonvalues
Class ImmutableJsons
- java.lang.Object
-
- jsonvalues.ImmutableJsons
-
public final class ImmutableJsons extends Object
Factory to create immutable jsons. New factories can be created with different map and seq implementations using the methodswithMap(Class)
andwithSeq(Class)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ImmutableJsons.ImmutableJsArrays
represents a factory of immutable Json arraysclass
ImmutableJsons.ImmutableJsObjs
represents a factory of immutable Json objects
-
Field Summary
Fields Modifier and Type Field Description ImmutableJsons.ImmutableJsArrays
array
represents a factory of immutable Json arraysImmutableJsons.ImmutableJsObjs
object
represents a factory of immutable Json objects
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Try
parse(String str)
Tries to parse the string into an immutable json.Try
parse(String str, ParseBuilder builder)
Tries to parse the string into an immutable json, performing the specified transformations while the parsing.Json<?>
toImmutable(Json<?> json)
converts the given json using this factory to an immutable one, if it's not immutable, returning the same instance otherwise.ImmutableJsons
withMap(Class<? extends ImmutableMap> map)
returns a new factory of immutable Jsons using as underlying data structure to store elements of Json objects the given as a parameterImmutableJsons
withSeq(Class<? extends ImmutableSeq> seq)
returns a new factory of immutable Jsons using as underlying data structure to store elements of Json arrays the given as a parameter
-
-
-
Field Detail
-
array
public final ImmutableJsons.ImmutableJsArrays array
represents a factory of immutable Json arrays
-
object
public final ImmutableJsons.ImmutableJsObjs object
represents a factory of immutable Json objects
-
-
Method Detail
-
toImmutable
public Json<?> toImmutable(Json<?> json)
converts the given json using this factory to an immutable one, if it's not immutable, returning the same instance otherwise.- Parameters:
json
- the given json- Returns:
- an immutable json
-
parse
public Try parse(String str)
Tries to parse the string into an immutable json.- Parameters:
str
- the string that will be parsed- Returns:
- a
Try
computation
-
parse
public Try parse(String str, ParseBuilder builder)
Tries to parse the string into an immutable json, performing the specified transformations while the parsing.- Parameters:
str
- the string that will be parsedbuilder
- a builder with the transformations that will be applied during the parsing- Returns:
- a
Try
computation
-
withMap
public ImmutableJsons withMap(Class<? extends ImmutableMap> map)
returns a new factory of immutable Jsons using as underlying data structure to store elements of Json objects the given as a parameter- Parameters:
map
- the underlying data structure to store elements of Json objects in the factory- Returns:
- a new factory of immutable Jsons
-
withSeq
public ImmutableJsons withSeq(Class<? extends ImmutableSeq> seq)
returns a new factory of immutable Jsons using as underlying data structure to store elements of Json arrays the given as a parameter- Parameters:
seq
- the underlying data structure to store elements of Json arrays in the factory- Returns:
- a new factory of immutable Jsons
-
-