All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.maxifier.mxcache.transform.ScalarTransformGenerator Maven / Gradle / Ivy

Go to download

Constains all classes necessary for launching a MxCache-instrumentated application

There is a newer version: 2.6.9
Show newest version
/*
 * Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
 */
package com.maxifier.mxcache.transform;

import com.maxifier.mxcache.provider.Signature;

/**
 * @author Alexander Kochurov ([email protected])
 */
public abstract class ScalarTransformGenerator implements TransformGenerator {
    public abstract Class getTransformedType(Class in);

    @Override
    public Signature transformKey(Signature in) {
        if (in.getContainer() == null) {
            throw new IllegalArgumentException("Cannot transform signature without key!");
        }
        int keyCount = in.getKeyCount();
        if (keyCount != 1) {
            throw new UnsupportedOperationException("Scalar transform cannot be applied to tuple");
        }
        return in.overrideKey(getTransformedType(in.getKey(0)));
    }

    @Override
    public Signature transformValue(Signature in) {
        return in.overrideValue(getTransformedType(in.getValue()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy