public class PbCodegenUtils extends Object
Constructor and Description |
---|
PbCodegenUtils() |
Modifier and Type | Method and Description |
---|---|
static Class |
compileClass(ClassLoader classloader,
String className,
String code) |
static String |
convertFlinkArrayElementToPbWithDefaultValueCode(String flinkArrDataVar,
String iVar,
String resultPbVar,
com.google.protobuf.Descriptors.FieldDescriptor elementPbFd,
LogicalType elementDataType,
PbFormatContext pbFormatContext,
int indent)
This method will be called from serializer of flink array/map type because flink contains
both array/map type in array format.
|
static String |
flinkContainerElementCode(String flinkContainerCode,
String index,
LogicalType eleType) |
static String |
getTypeStrFromLogicType(LogicalType type)
Get java type str from
LogicalType which directly fetched from flink type. |
static String |
getTypeStrFromProto(com.google.protobuf.Descriptors.FieldDescriptor fd,
boolean isList)
Get java type str from
Descriptors.FieldDescriptor which directly fetched from protobuf object. |
static String |
pbDefaultValueCode(com.google.protobuf.Descriptors.FieldDescriptor fieldDescriptor,
PbFormatContext pbFormatContext)
Get protobuf default value from
Descriptors.FieldDescriptor . |
public static String flinkContainerElementCode(String flinkContainerCode, String index, LogicalType eleType)
flinkContainerCode
- code phrase which represent flink container type like row/array in
codegen sectionsindex
- the index number in flink container typeeleType
- the element typepublic static String getTypeStrFromProto(com.google.protobuf.Descriptors.FieldDescriptor fd, boolean isList) throws PbCodegenException
Descriptors.FieldDescriptor
which directly fetched from protobuf object.PbCodegenException
public static String getTypeStrFromLogicType(LogicalType type)
LogicalType
which directly fetched from flink type.public static String pbDefaultValueCode(com.google.protobuf.Descriptors.FieldDescriptor fieldDescriptor, PbFormatContext pbFormatContext) throws PbCodegenException
Descriptors.FieldDescriptor
.PbCodegenException
public static String convertFlinkArrayElementToPbWithDefaultValueCode(String flinkArrDataVar, String iVar, String resultPbVar, com.google.protobuf.Descriptors.FieldDescriptor elementPbFd, LogicalType elementDataType, PbFormatContext pbFormatContext, int indent) throws PbCodegenException
flinkArrDataVar
- code phrase represent arrayData of arr type or keyData/valueData in
map type.iVar
- the index in arrDataVarresultPbVar
- the returned pb variable name in codegen.elementPbFd
- Descriptors.FieldDescriptor
of element type in proto objectelementDataType
- LogicalType
of element type in flink objectPbCodegenException
public static Class compileClass(ClassLoader classloader, String className, String code) throws ClassNotFoundException
ClassNotFoundException
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.