code: def to_java_state_ttl_config(ttl_config: StateTtlConfig):
      j_ttl_config_builder = JStateTtlConfig.newBuilder(
          JTime.milliseconds(ttl_config.get_ttl().to_milliseconds())
      )
  
      update_type = ttl_config.get_update_type()
      if update_type == StateTtlConfig.UpdateType.Disabled:
          j_ttl_config_builder.setUpdateType(JUpdateType.Disabled)
      elif update_type == StateTtlConfig.UpdateType.OnCreateAndWrite:
          j_ttl_config_builder.setUpdateType(
              JUpdateType.OnCreateAndWrite
          )
      elif update_type == StateTtlConfig.UpdateType.OnReadAndWrite:
          j_ttl_config_builder.setUpdateType(JUpdateType.OnReadAndWrite)
  
      state_visibility = ttl_config.get_state_visibility()
      if (
          state_visibility
          == StateTtlConfig.StateVisibility.ReturnExpiredIfNotCleanedUp
      ):
          j_ttl_config_builder.setStateVisibility(
              JStateVisibility.ReturnExpiredIfNotCleanedUp
          )
      elif (
          state_visibility
          == StateTtlConfig.StateVisibility.NeverReturnExpired
      ):
          j_ttl_config_builder.setStateVisibility(
              JStateVisibility.NeverReturnExpired
          )
  
      cleanup_strategies = ttl_config.get_cleanup_strategies()
      if not cleanup_strategies.is_cleanup_in_background():
          j_ttl_config_builder.disableCleanupInBackground()
  
      if cleanup_strategies.in_full_snapshot():
          j_ttl_config_builder.cleanupFullSnapshot()
  
      incremental_cleanup_strategy = (
          cleanup_strategies.get_incremental_cleanup_strategy()
      )
      if incremental_cleanup_strategy:
          j_ttl_config_builder.cleanupIncrementally(
              incremental_cleanup_strategy.get_cleanup_size(),
              incremental_cleanup_strategy.run_cleanup_for_every_record(),
          )
  
      rocksdb_compact_filter_cleanup_strategy = (
          cleanup_strategies.get_rocksdb_compact_filter_cleanup_strategy()
      )
  
      if rocksdb_compact_filter_cleanup_strategy:
          j_ttl_config_builder.cleanupInRocksdbCompactFilter(
              rocksdb_compact_filter_cleanup_strategy.get_query_time_after_num_entries(),
              rocksdb_compact_filter_cleanup_strategy.get_periodic_compaction_time(),
          )
  
      return j_ttl_config_builder.build()
  
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 2 for calling a global function with example usage: to_java_state_ttl_config(ttl_config) and returns: j_ttl_config_builder