Package yapion
Class YAPIONUtils
- java.lang.Object
-
- yapion.YAPIONUtils
-
public class YAPIONUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
YAPIONUtils.CheckResult
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FILE_ENDING
This is the default file ending associated by a file with the format yapion, For more information seeYAPIONParser
orYAPIONInputStream
.static java.lang.String
FILE_ENDING_POINT
This is the default file ending associated by a file with the format yapion, For more information seeYAPIONParser
orYAPIONInputStream
.
-
Method Summary
Modifier and Type Method Description static YAPIONObject
flatten(YAPIONObject yapionObject)
The inputtedYAPIONObject
is flattened to oneYAPIONObject
as the main layer.static YAPIONUtils.CheckResult
isBase64YAPIONObject(java.lang.String base64)
Check if a base64 encoded String can be a YAPION Object serialized by theYAPIONSerializer
that can be deserialized by theYAPIONDeserializer
.static YAPIONUtils.CheckResult
isStringYAPIONObject(java.lang.String string)
Check if a generic String can be a YAPION Object serialized by theYAPIONSerializer
that can be deserialized by theYAPIONDeserializer
.static YAPIONUtils.CheckResult
stringContainsYAPIONObject(java.lang.String string)
Check if a generic String has YAPIONObjects embedded which can be deserialized by theYAPIONDeserializer
.static java.util.List<YAPIONObject>
stringGetAllYAPIONObjects(java.lang.String string)
Retrieve anyYAPIONObject
embedded in an generic String.static YAPIONObject
unflatten(YAPIONObject yapionObject)
static java.util.stream.Stream<YAPIONAnyType>
walk(YAPIONObject yapionObject)
The inputtedYAPIONObject
is traversed depth first, values beforehand.static <T extends YAPIONAnyType>
java.util.stream.Stream<T>walk(YAPIONObject yapionObject, java.lang.Class<T> classToWalk)
The inputtedYAPIONObject
is traversed depth first, values beforehand.static java.util.stream.Stream<YAPIONAnyType>
walk(YAPIONObject yapionObject, YAPIONTreeIterator.YAPIONTreeIteratorOption option)
The inputtedYAPIONObject
is traversed depth first, values beforehand.
-
-
-
Field Detail
-
FILE_ENDING
public static final java.lang.String FILE_ENDING
This is the default file ending associated by a file with the format yapion, For more information seeYAPIONParser
orYAPIONInputStream
.- See Also:
- Constant Field Values
-
FILE_ENDING_POINT
public static final java.lang.String FILE_ENDING_POINT
This is the default file ending associated by a file with the format yapion, For more information seeYAPIONParser
orYAPIONInputStream
.- See Also:
- Constant Field Values
-
-
Method Detail
-
isBase64YAPIONObject
public static YAPIONUtils.CheckResult isBase64YAPIONObject(java.lang.String base64)
Check if a base64 encoded String can be a YAPION Object serialized by theYAPIONSerializer
that can be deserialized by theYAPIONDeserializer
.- Parameters:
base64
- the base64 string to check- Returns:
- the estimate if the string is yapion or not
-
isStringYAPIONObject
public static YAPIONUtils.CheckResult isStringYAPIONObject(java.lang.String string)
Check if a generic String can be a YAPION Object serialized by theYAPIONSerializer
that can be deserialized by theYAPIONDeserializer
.- Parameters:
string
- the string to check- Returns:
- the estimate if the string is yapion or not
-
stringContainsYAPIONObject
public static YAPIONUtils.CheckResult stringContainsYAPIONObject(java.lang.String string)
Check if a generic String has YAPIONObjects embedded which can be deserialized by theYAPIONDeserializer
.- Parameters:
string
- the string to check- Returns:
- the result if the String contains an
YAPIONObject
-
stringGetAllYAPIONObjects
public static java.util.List<YAPIONObject> stringGetAllYAPIONObjects(java.lang.String string)
Retrieve anyYAPIONObject
embedded in an generic String.- Parameters:
string
- the string to extract from- Returns:
- all
YAPIONObject
's that got extracted
-
walk
public static java.util.stream.Stream<YAPIONAnyType> walk(YAPIONObject yapionObject, YAPIONTreeIterator.YAPIONTreeIteratorOption option)
The inputtedYAPIONObject
is traversed depth first, values beforehand. Outputs anStream
ofYAPIONAnyType
of all keys in the wholeYAPIONObject
. This method is inspired byFiles.walk(Path, FileVisitOption...)
- Parameters:
yapionObject
- theYAPIONObject
to traverseoption
- theYAPIONTreeIterator.YAPIONTreeIteratorOption
to use- Returns:
- the
Stream
which contains allYAPIONAnyType
of theYAPIONObject
-
walk
public static <T extends YAPIONAnyType> java.util.stream.Stream<T> walk(YAPIONObject yapionObject, java.lang.Class<T> classToWalk)
The inputtedYAPIONObject
is traversed depth first, values beforehand. Outputs anStream
ofYAPIONAnyType
of all keys in the wholeYAPIONObject
. This method is inspired byFiles.walk(Path, FileVisitOption...)
- Type Parameters:
T
- the type to walk- Parameters:
yapionObject
- to traverseclassToWalk
- the class of given type- Returns:
- the
Stream
which contains all 'T' of theYAPIONObject
-
walk
public static java.util.stream.Stream<YAPIONAnyType> walk(YAPIONObject yapionObject)
The inputtedYAPIONObject
is traversed depth first, values beforehand. Outputs anStream
ofYAPIONAnyType
of all keys in the wholeYAPIONObject
. This method is inspired byFiles.walk(Path, FileVisitOption...)
- Parameters:
yapionObject
- theYAPIONObject
to traverse- Returns:
- the
Stream
which contains allYAPIONAnyType
of theYAPIONObject
-
flatten
public static YAPIONObject flatten(YAPIONObject yapionObject)
The inputtedYAPIONObject
is flattened to oneYAPIONObject
as the main layer. Every value will be put under this and every structure will be removed. This will also remove any information about maps arrays and such.
(@pointer:...) will represent a pointer- Parameters:
yapionObject
- theYAPIONObject
to flatten- Returns:
- the flattened
YAPIONObject
this is a new instance
-
unflatten
public static YAPIONObject unflatten(YAPIONObject yapionObject)
-
-