Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2010-2011 Sonatype, Inc. 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 Contributors: /
package org.hudsonci.jaxb;
Adds java.lang.Cloneable and java.lang.Object.clone() implementation to all classes.

Jason Dillon
public class CloneablePlugin
    public String getOptionName() {
        return "Xcloneable";
    public String getUsage() {
        return "Adds Cloneable and Object.clone() implementation to all classes.";
    protected boolean run(final Outline outlinefinal Options optionsthrows Exception {
        assert outline != null;
        assert options != null;
        for (ClassOutline type : outline.getClasses()) {
        return true;
    private void processClassOutline(final ClassOutline outline) {
        assert outline != null;
        JDefinedClass type = outline.implClass;
        JCodeModel model = type.owner();
        JMethod method = type.method(.outline.implRef"clone");
        JBlock body = method.body();
        JTryBlock block = body._try();
        block.body()._return(JExpr.cast(outline.implRef, JExpr._super().invoke("clone")));
New to GrepCode? Check out our FAQ X