Constructor and Description |
---|
JavaUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
append(StringBuilder builder,
String indent,
String line)
Shortcut to append a line of generated code
|
static String |
charset(String encoding)
Code to fetch an instance of
Charset corresponding to the given encoding. |
static String |
charsetName(String encoding)
Code to fetch the name of the
Charset given the encoding. |
static String |
formatClassName(String className)
Format a class name for the generated code.
|
static String |
formatForJavaKeyword(String value)
Format a name for generated code.
|
static String |
formatGetterName(String propertyName)
Format a Getter name for generated code.
|
static String |
formatPropertyName(String value)
Format a property name for generated code.
|
static void |
generateFlyweightPropertyJavadoc(StringBuilder sb,
String indent,
Token propertyToken,
String typeName)
Generate the Javadoc comment header for flyweight property.
|
static void |
generateGroupEncodePropertyJavadoc(StringBuilder sb,
String indent,
Token propertyToken,
String typeName)
Generate the Javadoc comment header for group encode property.
|
static String |
generateLiteral(PrimitiveType type,
String value)
Generate a literal value to be used in code generation.
|
static void |
generateOptionDecodeJavadoc(Appendable out,
String indent,
Token optionToken)
Generate the Javadoc comment header for a bitset choice option decode method.
|
static void |
generateOptionEncodeJavadoc(Appendable out,
String indent,
Token optionToken)
Generate the Javadoc comment header for a bitset choice option encode method.
|
static void |
generateTypeJavadoc(StringBuilder sb,
String indent,
Token typeToken)
Generate the Javadoc comment header for a type.
|
static boolean |
isAsciiEncoding(String encoding)
Checks if the given encoding represents an ASCII charset.
|
static boolean |
isUtf8Encoding(String encoding)
Checks if the given encoding represents a UTF-8 charset.
|
static String |
javaTypeName(PrimitiveType primitiveType)
Map the name of a
PrimitiveType to a Java primitive type name. |
public static String javaTypeName(PrimitiveType primitiveType)
PrimitiveType
to a Java primitive type name.primitiveType
- to map.public static String formatPropertyName(String value)
If the formatted property name is a keyword then SbeTool.KEYWORD_APPEND_TOKEN
is appended if set.
value
- to be formatted.IllegalStateException
- if a keyword and SbeTool.KEYWORD_APPEND_TOKEN
is not set.public static String formatForJavaKeyword(String value)
If the formatted name is a keyword then SbeTool.KEYWORD_APPEND_TOKEN
is appended if set.
value
- to be formatted.IllegalStateException
- if a keyword and SbeTool.KEYWORD_APPEND_TOKEN
is not set.public static String formatGetterName(String propertyName)
propertyName
- to be formatted.public static String formatClassName(String className)
className
- to be formatted.public static void append(StringBuilder builder, String indent, String line)
builder
- string builder to which to append the lineindent
- current text indentationline
- line to be appendedpublic static String charset(String encoding)
Charset
corresponding to the given encoding.encoding
- as a string name (eg. UTF-8).public static String charsetName(String encoding)
Charset
given the encoding.encoding
- as a string name (eg. UTF-8).public static boolean isAsciiEncoding(String encoding)
encoding
- as a string name (e.g. ASCII).true
if the encoding denotes an ASCII charset.public static boolean isUtf8Encoding(String encoding)
encoding
- as a string name (e.g. unicode-1-1-utf-8).true
if the encoding denotes a UTF-8 charset.public static String generateLiteral(PrimitiveType type, String value)
type
- of the lateral value.value
- of the lateral.public static void generateTypeJavadoc(StringBuilder sb, String indent, Token typeToken)
sb
- to append to.indent
- level for the comment.typeToken
- for the type.public static void generateOptionDecodeJavadoc(Appendable out, String indent, Token optionToken) throws IOException
out
- to append to.indent
- level for the comment.optionToken
- for the type.IOException
- on failing to write to output.public static void generateOptionEncodeJavadoc(Appendable out, String indent, Token optionToken) throws IOException
out
- to append to.indent
- level for the comment.optionToken
- for the type.IOException
- on failing to write to output.public static void generateFlyweightPropertyJavadoc(StringBuilder sb, String indent, Token propertyToken, String typeName)
sb
- to append to.indent
- level for the comment.propertyToken
- for the property name.typeName
- for the property type.public static void generateGroupEncodePropertyJavadoc(StringBuilder sb, String indent, Token propertyToken, String typeName)
sb
- to append to.indent
- level for the comment.propertyToken
- for the property name.typeName
- for the property type.Copyright © 2013-2024 Real Logic Limited. All Rights Reserved.