Class CSharpUtil

java.lang.Object
uk.co.real_logic.sbe.generation.csharp.CSharpUtil

public class CSharpUtil extends Object
Utilities for mapping between IR and the C# language.
  • Constructor Details

    • CSharpUtil

      public CSharpUtil()
  • Method Details

    • toUpperFirstChar

      public static String toUpperFirstChar(String str)
      Uppercase the first character of a given String.
      Parameters:
      str - to have the first character upper-cased.
      Returns:
      a new String with the first character in uppercase.
    • toLowerFirstChar

      public static String toLowerFirstChar(String str)
      Lowercase the first character of a given String.
      Parameters:
      str - to have the first character upper-cased.
      Returns:
      a new String with the first character in uppercase.
    • formatPropertyName

      public static String formatPropertyName(String str)
      Format a String as a property name.
      Parameters:
      str - to be formatted.
      Returns:
      the string formatted as a property name.
    • formatForCSharpKeyword

      public static String formatForCSharpKeyword(String value)
      Format a String with a suffix in case it's a keyword.
      Parameters:
      value - to be formatted.
      Returns:
      the formatted string.
    • formatVariableName

      public static String formatVariableName(String str)
      Format a String as a variable name.
      Parameters:
      str - to be formatted.
      Returns:
      the string formatted as a property name.
    • formatClassName

      public static String formatClassName(String str)
      Format a String as a class name.
      Parameters:
      str - to be formatted.
      Returns:
      the string formatted as a class name.
    • formatGetterName

      public static String formatGetterName(String propertyName)
      Format a Getter name for generated code.
      Parameters:
      propertyName - to be formatted.
      Returns:
      the property name formatted as a getter name.
    • append

      public static void append(StringBuilder builder, String indent, String line)
      Shortcut to append a line of generated code
      Parameters:
      builder - string builder to which to append the line
      indent - current text indentation
      line - line to be appended