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

com.dchan.jaxb.CodeCreator Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package com.dchan.jaxb;

import com.sun.codemodel.JAnnotationUse;
import com.sun.codemodel.JClass;
import com.sun.codemodel.JDefinedClass;
import com.sun.codemodel.JPackage;
import com.sun.tools.xjc.outline.ClassOutline;
import com.sun.tools.xjc.outline.Outline;

import javax.annotation.Generated;
import java.util.Set;

abstract class CodeCreator {

    protected final JPackage jpackage;
    protected final Outline outline;
    private JDefinedClass output;

    CodeCreator(Outline outline, JPackage jPackage) {
        this.outline = outline;
        this.jpackage = jPackage;
    }

    protected abstract void run(Set classes, Set directClasses);

    JDefinedClass getOutput() {
        return output;
    }
    
    void setOutput(JDefinedClass output) {
        JAnnotationUse annotationUse = output.annotate(Generated.class);
        annotationUse.param("value", "Generated by jaxb-visitor");
        this.output = output;
    }

    protected JPackage getPackage() {
        return jpackage;
    }

    protected Outline getOutline() {
        return outline;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy