ContextVariableTypes Class
- java.
lang. Object - com.
microsoft. semantickernel. contextvariables. ContextVariableTypes
- com.
public class ContextVariableTypes
A collection of context variable types, with converters to convert objects to the types.
Constructor Summary
Constructor | Description |
---|---|
ContextVariableTypes() |
Create a new collection of context variable types. |
ContextVariableTypes(ContextVariableTypes contextVariableTypes) |
Create a new collection of context variable types. |
ContextVariableTypes(List<ContextVariableTypeConverter<?>> converters) |
Create a new collection of context variable types. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Context |
contextVariableOf(T value)
Create a context variable of the given value. |
static T |
convert(Object s, Class<T> clazz)
Convert the given object to the given class, if possible. |
static
Context |
getGlobalVariableTypeForClass(Class<T> aClass)
Get the global context variable type for the given class. |
Context |
getVariableTypeForClass(Class<T> aClass)
Get the context variable type for the given class. |
Context |
getVariableTypeForSuperClass(Class<T> aClass)
Get the context variable type for the given class or for a type that is assignable from the given class. |
void |
putConverter(ContextVariableTypeConverter<T> contextVariableTypeConverter)
Add a converter to this |
static void |
addGlobalConverter(ContextVariableTypeConverter<?> converter)
Add a converter to the global collection of context variable type converters. |
static
Context |
getGlobalTypes()
Get the globally available collectors, which is the default collection of context variable types and those that have been added with addGlobalConverter(ContextVariableTypeConverter<?> converter). |
void |
putConverters(ContextVariableTypes contextVariableTypes)
Add all the converters from the given collection to this collection. |
Methods inherited from java.lang.Object
Constructor Details
ContextVariableTypes
public ContextVariableTypes()
Create a new collection of context variable types.
ContextVariableTypes
public ContextVariableTypes(ContextVariableTypes contextVariableTypes)
Create a new collection of context variable types.
Parameters:
ContextVariableTypes
public ContextVariableTypes(List
Create a new collection of context variable types.
Parameters:
Method Details
contextVariableOf
public ContextVariable
Create a context variable of the given value.
Parameters:
Returns:
convert
public static T
Convert the given object to the given class, if possible.
Parameters:
Returns:
null
if the object cannot be convertedgetGlobalVariableTypeForClass
public static ContextVariableType
Get the global context variable type for the given class.
Parameters:
Returns:
getVariableTypeForClass
public ContextVariableType
Get the context variable type for the given class.
Parameters:
Returns:
getVariableTypeForSuperClass
public ContextVariableType
Get the context variable type for the given class or for a type that is assignable from the given class. its super class.
Parameters:
Returns:
putConverter
public void
Add a converter to this ContextVariableTypes
instance.
Parameters:
addGlobalConverter
public static void addGlobalConverter(ContextVariableTypeConverter converter)
Add a converter to the global collection of context variable type converters.
Parameters:
getGlobalTypes
public static ContextVariableTypes getGlobalTypes()
Get the globally available collectors, which is the default collection of context variable types and those that have been added with addGlobalConverter(ContextVariableTypeConverter<?> converter).
Returns:
putConverters
public void putConverters(ContextVariableTypes contextVariableTypes)
Add all the converters from the given collection to this collection.
Parameters: