Class FileFormatKt
-
- All Implemented Interfaces:
public final class FileFormatKt
-
-
Method Summary
Modifier and Type Method Description final static ObjectMappermapper(File $self)Get the Jackson ObjectMapper for this file based on the file extension configured in FileFormat.mapper. final static JsonNodereadTree(File $self)Use the Jackson mapper returned from File.mapper to read a tree of (JSON) nodes from this file. final static <T extends Any> TreadValue(File $self)Use the Jackson mapper returned from File.mapper to read an object of type T from this file. final static <T extends Any> TreadValueOrNull(File $self)Use the Jackson mapper returned from File.mapper to read an object of type T from this file, or return null if the file has no content. final static <T extends Any> TreadValueOrDefault(File $self, T default)Use the Jackson mapper returned from File.mapper to read an object of type T from this file, or return the default value if the file has no content. final static <T extends Any> UnitwriteValue(File $self, T value, Boolean prettyPrint)Use the Jackson mapper returned from File.mapper to write an object of type T to this file. -
-
Method Detail
-
mapper
final static ObjectMapper mapper(File $self)
Get the Jackson ObjectMapper for this file based on the file extension configured in FileFormat.mapper.
-
readTree
final static JsonNode readTree(File $self)
Use the Jackson mapper returned from File.mapper to read a tree of (JSON) nodes from this file.
-
readValue
final static <T extends Any> T readValue(File $self)
Use the Jackson mapper returned from File.mapper to read an object of type T from this file.
-
readValueOrNull
final static <T extends Any> T readValueOrNull(File $self)
Use the Jackson mapper returned from File.mapper to read an object of type T from this file, or return null if the file has no content.
-
readValueOrDefault
final static <T extends Any> T readValueOrDefault(File $self, T default)
Use the Jackson mapper returned from File.mapper to read an object of type T from this file, or return the default value if the file has no content.
-
writeValue
final static <T extends Any> Unit writeValue(File $self, T value, Boolean prettyPrint)
Use the Jackson mapper returned from File.mapper to write an object of type T to this file. prettyPrint indicates whether to use pretty printing or not. The function also ensures that the parent directory exists.
-
-
-
-