Package jsonvalues
Class ImmutableJsons.ImmutableJsArrays
- java.lang.Object
-
- jsonvalues.ImmutableJsons.ImmutableJsArrays
-
- Enclosing class:
- ImmutableJsons
public class ImmutableJsons.ImmutableJsArrays extends Object
represents a factory of immutable Json arrays
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsArrayempty()Returns the immutable empty array.JsArrayof(boolean bool, boolean... others)Returns an immutable array from one or more booleans.JsArrayof(double number, double... others)Returns an immutable array from one or more doubles.JsArrayof(int number, int... others)Returns an immutable array from one or more integers.JsArrayof(long number, long... others)Returns an immutable array from one or more longs.JsArrayof(String str, String... others)Returns an immutable array from one or more strings.JsArrayof(JsElem e)JsArrayof(JsElem e, JsElem e1)Returns an immutable two-element array.JsArrayof(JsElem e, JsElem e1, JsElem e2)Returns an immutable three-element array.JsArrayof(JsElem e, JsElem e1, JsElem e2, JsElem e3)Returns an immutable four-element array.JsArrayof(JsElem e, JsElem e1, JsElem e2, JsElem e3, JsElem e4)Returns an immutable five-element array.JsArrayof(JsElem e, JsElem e1, JsElem e2, JsElem e3, JsElem e4, JsElem... rest)Returns an immutable array.JsArrayof(JsPair pair, JsPair... others)Returns an immutable array from one or more pairs.JsArrayofIterable(Iterable<JsElem> iterable)returns an immutable json array from an iterable of json elementsTryArrparse(String str)Tries to parse the string into an immutable json array.TryArrparse(String str, ParseBuilder builder)JsArraytoImmutable(JsArray mutable)
-
-
-
Method Detail
-
empty
public JsArray empty()
Returns the immutable empty array. The same instance is always returned.- Returns:
- the singleton immutable empty JsArray
-
of
public JsArray of(JsPair pair, JsPair... others)
Returns an immutable array from one or more pairs.- Parameters:
pair- a pairothers- more optional pairs- Returns:
- an immutable JsArray
- Throws:
UserError- if an elem of a pair is mutable
-
of
public JsArray of(JsElem e, JsElem e1)
Returns an immutable two-element array.- Parameters:
e- a JsEleme1- a JsElem- Returns:
- an immutable two-element JsArray
- Throws:
UserError- if an elem is a mutable Json
-
of
public JsArray of(JsElem e, JsElem e1, JsElem e2)
Returns an immutable three-element array.- Parameters:
e- a JsEleme1- a JsEleme2- a JsElem- Returns:
- an immutable three-element JsArray
- Throws:
UserError- if an elem is a mutable Json
-
of
public JsArray of(JsElem e, JsElem e1, JsElem e2, JsElem e3)
Returns an immutable four-element array.- Parameters:
e- a JsEleme1- a JsEleme2- a JsEleme3- a JsElem- Returns:
- an immutable four-element JsArray
- Throws:
UserError- if an elem is a mutable Json
-
of
public JsArray of(JsElem e, JsElem e1, JsElem e2, JsElem e3, JsElem e4)
Returns an immutable five-element array.- Parameters:
e- a JsEleme1- a JsEleme2- a JsEleme3- a JsEleme4- a JsElem- Returns:
- an immutable five-element JsArray
- Throws:
UserError- if an elem is a mutable Json
-
of
public JsArray of(JsElem e, JsElem e1, JsElem e2, JsElem e3, JsElem e4, JsElem... rest)
Returns an immutable array.- Parameters:
e- a JsEleme1- a JsEleme2- a JsEleme3- a JsEleme4- a JsElemrest- more optional JsElem- Returns:
- an immutable JsArray
- Throws:
UserError- if an elem is a mutable Json
-
ofIterable
public JsArray ofIterable(Iterable<JsElem> iterable)
returns an immutable json array from an iterable of json elements- Parameters:
iterable- the iterable of json elements- Returns:
- an immutable json array
-
of
public JsArray of(String str, String... others)
Returns an immutable array from one or more strings.- Parameters:
str- a stringothers- more optional strings- Returns:
- an immutable JsArray
-
of
public JsArray of(int number, int... others)
Returns an immutable array from one or more integers.- Parameters:
number- an integerothers- more optional integers- Returns:
- an immutable JsArray
-
of
public JsArray of(boolean bool, boolean... others)
Returns an immutable array from one or more booleans.- Parameters:
bool- an booleanothers- more optional booleans- Returns:
- an immutable JsArray
-
of
public JsArray of(long number, long... others)
Returns an immutable array from one or more longs.- Parameters:
number- a longothers- more optional longs- Returns:
- an immutable JsArray
-
of
public JsArray of(double number, double... others)
Returns an immutable array from one or more doubles.- Parameters:
number- a doubleothers- more optional doubles- Returns:
- an immutable JsArray
-
parse
public TryArr parse(String str)
Tries to parse the string into an immutable json array.- Parameters:
str- the string to be parsed- Returns:
- a
TryArrcomputation
-
parse
public TryArr parse(String str, ParseBuilder builder)
-
-