public final class StringGenerator extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
createNewInstance(String className,
String space,
List<String> parameters)
Returns new instance string.
|
static String |
getDefaultDefinitionWithImpl(String classType,
String name,
String modifier,
String impl)
Returns default class definition for java file when implements a
interface.
|
static String |
getForLoopString(String space,
String type,
String var,
String data)
Returns for loop string.
|
static String |
getImportString(String pkg,
String cls)
Returns import string.
|
static String |
getOverRideString()
Returns override string.
|
static String |
getStaticImportString(String pkg,
String cls)
Returns static import string.
|
static String |
getVariableDeclaration(String varName,
String varType,
String space,
String modifier,
String value)
Returns variable declaration string.
|
static boolean |
isPrimitiveDataType(org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes dataType)
Returns true, if the data type is primitive; false otherwise.
|
static String |
methodClose(IndentationType type)
Returns method close string.
|
static String |
methodSignature(String methodName,
String prefix,
String modifier,
String paraVal,
String methodReturnType,
String paraReturnType,
MethodClassTypes type)
Returns method signature for interface and implementation classes.
|
static String |
multiAttrMethodSignature(String methodName,
String prefix,
String modifier,
String methodReturnType,
Map<String,String> params,
MethodClassTypes type,
String space)
Returns method signature for multi attribute methods.
|
static String |
valueAssign(String param,
String value,
String indentation)
Returns value assignment.
|
public static String methodClose(IndentationType type)
type - indentation typepublic static String valueAssign(String param, String value, String indentation)
param - variable to which value to be assignedvalue - value to be assignedindentation - indentation of the statementpublic static String multiAttrMethodSignature(String methodName, String prefix, String modifier, String methodReturnType, Map<String,String> params, MethodClassTypes type, String space)
methodName - method nameprefix - prefix for methodmodifier - modifier for methodmethodReturnType - method's return typeparams - parameterstype - type of methodspace - indentation of methodpublic static String methodSignature(String methodName, String prefix, String modifier, String paraVal, String methodReturnType, String paraReturnType, MethodClassTypes type)
methodName - name of the methodprefix - prefix which needs to be added for methodmodifier - modifier which needs to be added for methodparaVal - value which needs to be added as parametermethodReturnType - returns type to be added for methodparaReturnType - return type to be added for parametertype - method class typepublic static boolean isPrimitiveDataType(org.onosproject.yang.compiler.datamodel.utils.builtindatatype.YangDataTypes dataType)
dataType - data typepublic static String getOverRideString()
public static String getDefaultDefinitionWithImpl(String classType, String name, String modifier, String impl)
classType - class typename - name of classmodifier - modifier for classimpl - implements class namepublic static String getImportString(String pkg, String cls)
pkg - packagecls - classpublic static String getForLoopString(String space, String type, String var, String data)
space - indentationtype - data typevar - variabledata - data variable/collectionpublic static String createNewInstance(String className, String space, List<String> parameters)
className - class namespace - indentationparameters - parameters for constructorpublic static String getVariableDeclaration(String varName, String varType, String space, String modifier, String value)
varName - name of variablevarType - type of variablespace - indentation of the statementmodifier - modifier namevalue - value to intialize the variableCopyright © 2018. All rights reserved.