Class MultilineString

java.lang.Object
com.mrivanplays.annotationconfig.core.resolver.MultilineString

public final class MultilineString extends Object
Represents a String value, which is annotated with Multiline, marking that it should be dumped as a multiline string, if the configuration type used supports them, otherwise should be dumped as a regular String.

If a Field is annotated with Multiline, then this object will be put into the map which a ValueWriter would receive. Example of handling this:


 Object value = // ...
 if (value instanceof MultilineString) {
   MultilineString multiline = (MultilineString) value;
   String toWrite = multiline.getString();
   char c = multiline.getMarkerChar();

   // do writer logic
 }

 
Since:
2.1.0
Author:
MrIvanPlays
See Also:
  • Constructor Details

  • Method Details

    • getString

      public String getString()
      Get the String to write.
      Returns:
      to write
    • getMarkerChar

      public char getMarkerChar()
      Returns the Character marker.

      A marker character could be the "pipe" or '|', could be the double quote or whatever char the configuration type this is going to be dumped to is supported.

      In YAML's scenario, the '|' or the '>' characters are used before the multiline string is specified, which makes them "marker" characters e.g.

       foo: |
         Lorem ipsum\n
         dolor sit amet
       
      Or
       foo: >
         Lorem ipsum\n
         dolor sit amet
       

      As shown by the examples above, this character in YAML's scenario could return '|' or '>' or the double quotes.

      Returns:
      marker character
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object