类 TypeConverter

java.lang.Object
com.github.codeboyzhou.mcp.declarative.util.TypeConverter

public final class TypeConverter extends Object
Helper class for Java and JSON schema type conversion.
作者:
codeboyzhou
  • 方法详细资料

    • convert

      public static Object convert(Object value, Class<?> targetType)
      Converts the given value to the specified target type. If the value is null, returns the default value for the target type.
      参数:
      value - the value to convert
      targetType - the target type to convert to
      返回:
      the converted value
    • convert

      public static Object convert(Object value, String jsonSchemaType)
      Converts the given value to the specified target type based on the JSON schema type. If the value is null, returns the default value for the JSON schema type.
      参数:
      value - the value to convert
      jsonSchemaType - the JSON schema type to convert to
      返回:
      the converted value