saker.build Documentation TaskDoc JavaDoc Packages
public final class ConversionContext
Contextual information for convertion an object to a target type.

This class holds useful information and objects for converting an object to a target type.

The base classloader is the classloader to use when considering the receiver class of the conversion. For example, it should be used when defining any Proxy objects, and the types should be examined to be assignable in the context of the base classloader. (This means that two different versions of the same target type class should be visible from the base classloader.)

The task result resolver should be used when encountering task execution related data. It can be used to retrieve the results for a given task identifier. Data converters should handle the case when they encounter instances of StructuredTaskResult or BuildTargetTaskResult as the value object. The task result resolver may be null in which case it cannot be used.

The conversion context holds information about the generic locations and what converters should be applied for them. See ConverterConfiguration for generic location example.

Methods
public ConversionContext
genericChildContext(int genericindex)
Cretes a conversion subcontext for the specified generic index.
public ClassLoader
Gets the base classloader to use.
public ConverterConfiguration
Gets the user specified converter configuration for the given generic argument location.
public ConverterConfiguration
Gets the current converter configuration that this conversion context should use.
public GenericArgumentLocation
Gets the current generic argument location that this conversion context is associated with.
public TaskResultResolver
Gets the task result resolver.
public boolean
Gets if there are any user defined converter configurations.
public ConversionContext genericChildContext(int genericindex)
Cretes a conversion subcontext for the specified generic index.

The generic index will be appended to the current generic argument location, and a new subcontext will be created with it. This new context should be used when converting elements to the generic type.

genericindexThe generic index.
A new conversion subcontext appended with the given generic index.
Gets the base classloader to use.
The base classloader.
Gets the user specified converter configuration for the given generic argument location.
argumentlocationThe generic argument location to get the converter configuration for.
The converter configuration or null if not defined.
Gets the current converter configuration that this conversion context should use.

It is the same as calling:

 conversioncontext.getConverterConfiguration(conversioncontext.getCurrentGenericLocation())
 
The current converter configuration or null if not defined.
Gets the current generic argument location that this conversion context is associated with.
The current generic argument location.
Gets the task result resolver.
The task result resolver or null if not available.
Gets if there are any user defined converter configurations.

If there are no converter configurations defined, getConverterConfiguration(GenericArgumentLocation) and getCurrentConverterConfiguration() will always return null, irrelevant of generic argument location. (This is true for subcontexts as well.)

true if there are converter configurations defined.