Class GeneratorTransformationRegistryImpl

    • Method Detail

      • map

        public Object map​(Object source)
        Description copied from interface: GeneratorTransformationRegistry
        Executes a transformation on the given object. This will use the first matching transformation that was configured using configure().
        Specified by:
        map in interface GeneratorTransformationRegistry
        Parameters:
        source - The object to transform
        Returns:
        The result of the transformation
      • withContext

        public void withContext​(Runnable runnable)
        Description copied from interface: GeneratorTransformationRegistry
        Creates a context in which one can run multiple transformations. Inside this context, transformed objects will be cached and reused. Once a context is over, this cache will be emptied, thus resulting in new objects being created.
        Specified by:
        withContext in interface GeneratorTransformationRegistry
        Parameters:
        runnable - Callback for running the transformations
      • withContext

        public void withContext​(Collection<ProvidedMapping> provided,
                                Runnable runnable)
        Description copied from interface: GeneratorTransformationRegistry
        Creates a context in which one can run multiple transformations. Inside this context, transformed objects will be cached and reused. Once a context is over, this cache will be emptied, thus resulting in new objects being created. Additionally, this allows for providing a set of already finished transformations that will be inserted into the cache. This can be used to inject predefined references to objects for given objects. Similarly, these will also be cleared once the context is over.
        Specified by:
        withContext in interface GeneratorTransformationRegistry
        Parameters:
        provided - Predefined set of transformations that should be inserted into the context
        runnable - Callback for running the transformations
      • map

        public <S,​T> T map​(S source,
                                 Class<T> target)
        Description copied from interface: GeneratorTransformationRegistry
        Executes a transformation on the given object. This, in comparison to map(S), makes sure that the type of the target is the provided type. This is necessary if there are two transformations configured for the same source but with different targets.
        Specified by:
        map in interface GeneratorTransformationRegistry
        Parameters:
        source - The object to transform
        target - The specific type of the target
        Returns:
        The result of the transformation