code: def to_java_typeinfo(type_info: TypeInformation):
      if isinstance(type_info, BasicTypeInfo):
          basic_type = type_info._basic_type
  
          if basic_type == BasicType.STRING:
              j_typeinfo = JTypes.STRING
          elif basic_type == BasicType.BYTE:
              j_typeinfo = JTypes.LONG
          elif basic_type == BasicType.BOOLEAN:
              j_typeinfo = JTypes.BOOLEAN
          elif basic_type == BasicType.SHORT:
              j_typeinfo = JTypes.LONG
          elif basic_type == BasicType.INT:
              j_typeinfo = JTypes.LONG
          elif basic_type == BasicType.LONG:
              j_typeinfo = JTypes.LONG
          elif basic_type == BasicType.FLOAT:
              j_typeinfo = JTypes.DOUBLE
          elif basic_type == BasicType.DOUBLE:
              j_typeinfo = JTypes.DOUBLE
          elif basic_type == BasicType.CHAR:
              j_typeinfo = JTypes.STRING
          elif basic_type == BasicType.BIG_INT:
              j_typeinfo = JTypes.BIG_INT
          elif basic_type == BasicType.BIG_DEC:
              j_typeinfo = JTypes.BIG_DEC
          elif basic_type == BasicType.INSTANT:
              j_typeinfo = JTypes.INSTANT
          else:
              raise TypeError("Invalid BasicType %s." % basic_type)
  
      elif isinstance(type_info, PrimitiveArrayTypeInfo):
          element_type = type_info._element_type
  
          if element_type == Types.BOOLEAN():
              j_typeinfo = (
                  JPrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
              )
          elif element_type == Types.BYTE():
              j_typeinfo = (
                  JPrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO
              )
          elif element_type == Types.SHORT():
              j_typeinfo = (
                  JPrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO
              )
          elif element_type == Types.INT():
              j_typeinfo = (
                  JPrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO
              )
          elif element_type == Types.LONG():
              j_typeinfo = (
                  JPrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO
              )
          elif element_type == Types.FLOAT():
              j_typeinfo = (
                  JPrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
              )
          elif element_type == Types.DOUBLE():
              j_typeinfo = (
                  JPrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
              )
          elif element_type == Types.CHAR():
              j_typeinfo = (
                  JPrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO
              )
          else:
              raise TypeError(
                  "Invalid element type for a primitive array."
              )
  
      elif isinstance(type_info, BasicArrayTypeInfo):
          element_type = type_info._element_type
  
          if element_type == Types.BOOLEAN():
              j_typeinfo = JBasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO
          elif element_type == Types.BYTE():
              j_typeinfo = JBasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO
          elif element_type == Types.SHORT():
              j_typeinfo = JBasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO
          elif element_type == Types.INT():
              j_typeinfo = JBasicArrayTypeInfo.INT_ARRAY_TYPE_INFO
          elif element_type == Types.LONG():
              j_typeinfo = JBasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO
          elif element_type == Types.FLOAT():
              j_typeinfo = JBasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO
          elif element_type == Types.DOUBLE():
              j_typeinfo = JBasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO
          elif element_type == Types.CHAR():
              j_typeinfo = JBasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO
          elif element_type == Types.STRING():
              j_typeinfo = JBasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO
          else:
              raise TypeError("Invalid element type for a basic array.")
  
      elif isinstance(type_info, ObjectArrayTypeInfo):
          element_type = type_info._element_type
  
          j_typeinfo = JTypes.OBJECT_ARRAY(
              to_java_typeinfo(element_type)
          )
  
      elif isinstance(type_info, MapTypeInfo):
          j_key_typeinfo = to_java_typeinfo(type_info._key_type_info)
          j_value_typeinfo = to_java_typeinfo(
              type_info._value_type_info
          )
  
          j_typeinfo = JMapTypeInfo(j_key_typeinfo, j_value_typeinfo)
      else:
          j_typeinfo = (
              JPickledByteArrayTypeInfo.PICKLED_BYTE_ARRAY_TYPE_INFO
          )
  
      return j_typeinfo
  
imports: from pemja import findClass
  from pyflink.common.typeinfo import TypeInformation, Types, BasicTypeInfo, BasicType, PrimitiveArrayTypeInfo, BasicArrayTypeInfo, ObjectArrayTypeInfo, MapTypeInfo
  from pyflink.datastream.state import StateDescriptor, ValueStateDescriptor, ReducingStateDescriptor, AggregatingStateDescriptor, ListStateDescriptor, MapStateDescriptor, StateTtlConfig
label_desc: Use image node_id 1 for calling a global function with example usage: to_java_typeinfo(type_info) and returns: j_typeinfo