1 /*************************************************************************************** 2 * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. * 3 * http://aspectwerkz.codehaus.org * 4 * ---------------------------------------------------------------------------------- * 5 * The software in this package is published under the terms of the LGPL license * 6 * a copy of which has been included with this distribution in the license.txt file. * 7 **************************************************************************************/ 8 package org.codehaus.aspectwerkz.transform.delegation; 9 10 import org.codehaus.aspectwerkz.transform.Context; 11 import org.codehaus.aspectwerkz.transform.Transformer; 12 13 /*** 14 * Add serial ver UID field 15 * 16 * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a> 17 */ 18 public class AddSerialVersionUidTransformer implements Transformer { 19 /*** 20 * Compute and add serial ver uid fiel 21 * 22 * @param context 23 * @param klass 24 * @throws Exception 25 */ 26 public void transform(Context context, Klass klass) throws Exception { 27 if (JavassistHelper.isSerialVerUidNeeded(klass.getCtClass())) { 28 long initialSerialVerUid = JavassistHelper.calculateSerialVerUid(klass.getInitialCtClass()); 29 JavassistHelper.setSerialVersionUID(klass.getCtClass(), initialSerialVerUid); 30 } 31 } 32 }