Package org.approvej.yaml.jackson
Record Class YamlPrintFormat<T>
java.lang.Object
java.lang.Record
org.approvej.yaml.jackson.YamlPrintFormat<T>
- Type Parameters:
T- the type of the object to print- Record Components:
objectWriter- theObjectWriterthat will be used for printing
- All Implemented Interfaces:
org.approvej.configuration.Provider<org.approvej.print.PrintFormat<T>>,org.approvej.print.PrintFormat<T>,org.approvej.print.PrintFormatProvider<T>
@NullMarked
public record YamlPrintFormat<T>(com.fasterxml.jackson.databind.ObjectWriter objectWriter)
extends Record
implements org.approvej.print.PrintFormat<T>, org.approvej.print.PrintFormatProvider<T>
A
PrintFormat that uses ObjectWriter.writeValueAsString(Object) to print a value
as YAML.-
Field Summary
Fields inherited from interface org.approvej.print.PrintFormat
DEFAULT_FILENAME_EXTENSION -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor to be used inConfiguration.YamlPrintFormat(com.fasterxml.jackson.databind.ObjectWriter objectWriter) Creates aYamlPrintFormatusing the givenObjectWriter. -
Method Summary
Modifier and TypeMethodDescriptionalias()org.approvej.print.PrintFormat<T> create()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.com.fasterxml.jackson.databind.ObjectWriterReturns the value of theobjectWriterrecord component.org.approvej.print.Printer<T> printer()final StringtoString()Returns a string representation of this record class.static <T> YamlPrintFormat<T> yaml()Creates aYamlPrintFormatusing the defaultYAMLMapper.static <T> YamlPrintFormat<T> yaml(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates aYamlPrintFormatusing the givenObjectMapper.static <T> YamlPrintFormat<T> yaml(com.fasterxml.jackson.databind.ObjectWriter objectWriter) Creates aYamlPrintFormatusing the givenObjectWriter.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.approvej.print.PrintFormatProvider
type
-
Constructor Details
-
YamlPrintFormat
public YamlPrintFormat(com.fasterxml.jackson.databind.ObjectWriter objectWriter) Creates aYamlPrintFormatusing the givenObjectWriter.- Parameters:
objectWriter- theObjectWriterthat will be used for printing
-
YamlPrintFormat
public YamlPrintFormat()Default constructor to be used inConfiguration.
-
-
Method Details
-
printer
- Specified by:
printerin interfaceorg.approvej.print.PrintFormat<T>
-
filenameExtension
- Specified by:
filenameExtensionin interfaceorg.approvej.print.PrintFormat<T>
-
alias
- Specified by:
aliasin interfaceorg.approvej.configuration.Provider<T>
-
create
- Specified by:
createin interfaceorg.approvej.configuration.Provider<T>
-
yaml
Creates aYamlPrintFormatusing the givenObjectWriter.- Type Parameters:
T- the type of value to print- Parameters:
objectWriter- theObjectWriterthat will be used for printing- Returns:
- a new
YamlPrintFormatinstance
-
yaml
Creates aYamlPrintFormatusing the givenObjectMapper.- Type Parameters:
T- the type of value to print- Parameters:
objectMapper- theObjectMapperused to create theObjectWriter- Returns:
- a new
YamlPrintFormatinstance - See Also:
-
yaml
Creates aYamlPrintFormatusing the defaultYAMLMapper.- Type Parameters:
T- the type of value to print- Returns:
- a new
YamlPrintFormatinstance - See Also:
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
objectWriter
public com.fasterxml.jackson.databind.ObjectWriter objectWriter()Returns the value of theobjectWriterrecord component.- Returns:
- the value of the
objectWriterrecord component
-