Class FileFormatKt

  • All Implemented Interfaces:

    
    public final class FileFormatKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static ObjectMapper mapper(File $self) Get the Jackson ObjectMapper for this file based on the file extension configured in FileFormat.mapper.
      final static JsonNode readTree(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> T readValue(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> 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.
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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.