Java tutorial
/** * Copyright (c) 2011-2013 Darmstadt University of Technology. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Sebastian Proksch - initial API and implementation */ package cc.recommenders.utils.gson; import java.lang.reflect.Type; import cc.recommenders.usages.features.UsageFeature; import com.google.gson.JsonElement; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; public class ObjectUsageFeatureRedirector<T> implements JsonSerializer<T> { @Override public JsonElement serialize(T src, Type typeOfSrc, JsonSerializationContext context) { return context.serialize(src, UsageFeature.class); } }