Package dev.denux.dtp
Class DTP
java.lang.Object
dev.denux.dtp.DTP
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TfromToml(TomlReader tomlReader, Class<T> clazzOfT) Serializes the given toml to a new instance of the given class.<T> TSerializes the given toml to a new instance of the given class.<T> TSerializes the given toml to a new instance of the given class.toToml(TomlWriter writer) Deserializes the givenObjectto a string that represents a toml file.Deserializes the givenObjectto a string that represents a toml file.voidwriteTomlToFile(Object source, File file, OpenOption... openOptions) voidwriteTomlToFile(Object source, Path path, OpenOption... openOptions)
-
Constructor Details
-
DTP
public DTP()
-
-
Method Details
-
fromToml
Serializes the given toml to a new instance of the given class. -
fromToml
Serializes the given toml to a new instance of the given class.- Type Parameters:
T- The object that will be returned.- Parameters:
tomlString- The string that represents a toml file.clazzOfT- TheClassof the object that we will instantiate.- Returns:
- the object or null if there was an exception while reading or serializing.
-
fromToml
Serializes the given toml to a new instance of the given class.- Type Parameters:
T- The object that will be returned.- Parameters:
tomlReader- theTomlReaderthat reads the toml file and formats it to make it easier for theTomlParser.clazzOfT- TheClassof the object that we will instantiate.- Returns:
- the object or null if there was an exception while reading or serializing.
-
toToml
Deserializes the givenObjectto a string that represents a toml file. -
toToml
Deserializes the givenObjectto a string that represents a toml file.- Parameters:
writer- theTomlWriterthat writes an object to aString.- Returns:
- the
Stringor null if there was an exception while writing.
-
writeTomlToFile
public void writeTomlToFile(@Nonnull Object source, @Nonnull File file, @Nullable OpenOption... openOptions) throws IOException - Parameters:
source- theObjectyou want to deserialize.file- theFileyou want to write to.openOptions-OpenOptions that describes how an existing file should be handled.- Throws:
IOException- is thrown when the file could not be written.
-
writeTomlToFile
public void writeTomlToFile(@Nonnull Object source, @Nonnull Path path, @Nullable OpenOption... openOptions) throws IOException - Parameters:
source- theObjectyou want to deserialize.path- thePathyou want to write theFileto.openOptions-OpenOptions that describes how an existing file should be handled.- Throws:
IOException- is thrown when the file could not be written.NullPointerException- is thrown if the givenObjectcould not be deserialized to a toml string.
-