ContextVariableTypeConverter<T> Class   
	- java.lang. Object 
- com.microsoft. semantickernel. contextvariables. ContextVariableTypeConverter<T> 
 
- com.
Type Parameters
- T
- the type of the context variable 
public class ContextVariableTypeConverter<T>
A converter for a context variable type. This class is used to convert objects to and from a prompt string, and to convert objects to the type of the context variable.
Constructor Summary
| Constructor | Description | 
|---|---|
| ContextVariableTypeConverter(Class<T> clazz, Function<Object,T> fromObject, ContextVariableTypeConverter.ToPromptStringFunction<T> toPromptString, Function<String,T> fromPromptString) | Create a new context variable type converter. | 
| ContextVariableTypeConverter(Class<T> clazz, Function<Object,T> fromObject, ContextVariableTypeConverter.ToPromptStringFunction<T> toPromptString, Function<String,T> fromPromptString, List<ContextVariableTypeConverter.Converter<T,?>> toObjects) | Create a new context variable type converter. | 
| ContextVariableTypeConverter(Class<T> clazz, Function<Object,T> fromObject, Function<T,String> toPromptString, Function<String,T> fromPromptString) | Create a new context variable type converter. | 
| ContextVariableTypeConverter(Class<T> clazz, Function<Object,T> fromObject, Function<T,String> toPromptString, Function<String,T> fromPromptString, List<ContextVariableTypeConverter.Converter<T,?>> toObjects) | Create a new context variable type converter. | 
Method Summary
| Modifier and Type | Method and Description | 
|---|---|
| static Builder<T> | builder(Class<T> clazz) Create a new builder for a context variable type converter. | 
| U | toObject(ContextVariableTypes types, Object t, Class<U> clazz) Use this converter to convert the object to the type of the context variable. | 
| U | toObject(ContextVariableTypes types, Object t, Class<U> clazz, boolean logWarnings) Use this converter to convert the object to the type of the context variable. | 
| static java.lang.String | escapeXmlString(String value) To be used when to | 
| T | fromObject(Object s) Convert the object to the type of the context variable using the  | 
| T | fromPromptString(String t) Convert the prompt string to the type using the  | 
| java.lang.Class<T> | getType() Get the class of the type. | 
| java.lang.String | toPromptString(ContextVariableTypes types, T t) Convert the type to a prompt string using the  | 
Methods inherited from java.lang.Object
Constructor Details
ContextVariableTypeConverter
public ContextVariableTypeConverter(Class
Create a new context variable type converter.
Parameters:
ContextVariableTypeConverter
public ContextVariableTypeConverter(Class
Create a new context variable type converter.
Parameters:
ContextVariableTypeConverter
public ContextVariableTypeConverter(Class
Create a new context variable type converter.
Parameters:
ContextVariableTypeConverter
public ContextVariableTypeConverter(Class
Create a new context variable type converter.
Parameters:
Method Details
builder
public static ContextVariableTypeConverter.Builder
Create a new builder for a context variable type converter.
Parameters:
Returns:
toObject
public U toObject(ContextVariableTypes types, Object t, Class clazz)
Use this converter to convert the object to the type of the context variable.
Parameters:
Returns:
toObject
public U toObject(ContextVariableTypes types, Object t, Class clazz, boolean logWarnings)
Use this converter to convert the object to the type of the context variable.
Parameters:
Returns:
escapeXmlString
public static String escapeXmlString(String value)
To be used when toPromptString is called
Parameters:
Returns:
fromObject
public T fromObject(Object s)
Convert the object to the type of the context variable using the fromObject function provided to the constructor.
Parameters:
Returns:
fromPromptString
public T fromPromptString(String t)
Convert the prompt string to the type using the fromPromptString function provided to the constructor.
Parameters:
Returns:
getType
public Class
Get the class of the type.
Returns:
toPromptString
public String toPromptString(ContextVariableTypes types, T t)
Convert the type to a prompt string using the toPromptString function provided to the constructor.
Parameters:
null the global types are used
							Returns: