Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.jvnet.hyperjaxb3.xjc.generator.bean.field.UntypedListFieldRenderer;
import org.jvnet.jaxb.plugin.AbstractParameterizablePlugin;
import org.jvnet.jaxb.util.CustomizationUtils;
import org.jvnet.jaxb.util.FieldAccessorFactory;
import org.jvnet.jaxb.util.GeneratorContextUtils;
import org.w3c.dom.Element;
import org.xml.sax.ErrorHandler;
Expand Down Expand Up @@ -84,6 +85,31 @@ public String getUsage() {
return " -Xhyperjaxb3-ejb: Hyperjaxb3 EJB plugin";
}

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("roundtripTestClassName".equals(propertyName)) {
setRoundtripTestClassName(value);
} else if ("persistenceUnitName".equals(propertyName)) {
setPersistenceUnitName(value);
} else if ("targetDir".equals(propertyName)) {
setTargetDir(new File(value));
} else if ("persistenceXml".equals(propertyName)) {
setPersistenceXml(new File(value));
} else if ("applicationContextClassName".equals(propertyName)) {
setApplicationContextClassName(value);
} else if ("applicationContext".equals(propertyName)) {
setApplicationContext((IApplicationContext) Class.forName(value).getDeclaredConstructor().newInstance());
} else if ("maxIdentifierLength".equals(propertyName)) {
setMaxIdentifierLength(Integer.parseInt(value));
} else if ("result".equals(propertyName)) {
setResult(value);
} else if ("generateTransientId".equals(propertyName)) {
setGenerateTransientId(Boolean.parseBoolean(value));
} else {
super.doSetProperty(propertyName, value);
}
}

private String roundtripTestClassName;

public String getRoundtripTestClassName() {
Expand Down Expand Up @@ -173,19 +199,18 @@ public String getResult() {
public void setResult(String variant) {
this.result = variant;
}
private boolean generateTransientId = false;

public String getModelAndOutlineProcessorBeanName() {
return getResult();
}

private String[] mergePersistenceUnits = new String[0];
public boolean isGenerateTransientId() {
return generateTransientId;
}

public String[] getMergePersistenceUnits() {
return mergePersistenceUnits;
}
public void setGenerateTransientId(boolean generateTransientId) {
this.generateTransientId = generateTransientId;
}

public void setMergePersistenceUnits(String[] mergePersistenceUnits) {
this.mergePersistenceUnits = mergePersistenceUnits;
public String getModelAndOutlineProcessorBeanName() {
return getResult();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,20 @@ public String getUsage() {
return "TBD";
}

private String defaultFieldTarget = "getter";
@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("defaultFieldTarget".equals(propertyName)) {
setDefaultFieldTarget(value);
} else if ("annotationParser".equals(propertyName)) {
setAnnotationParser((XAnnotationParser) Class.forName(value).getDeclaredConstructor().newInstance());
} else if ("annotator".equals(propertyName)) {
setAnnotator((Annotator) Class.forName(value).getDeclaredConstructor().newInstance());
} else {
super.doSetProperty(propertyName, value);
}
}

private String defaultFieldTarget = "getter";

public String getDefaultFieldTarget() {
return defaultFieldTarget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
import javax.xml.namespace.QName;

import org.jvnet.jaxb.annox.Constants;
import org.jvnet.jaxb.annox.parser.XAnnotationParser;
import org.jvnet.jaxb.annox.util.StringUtils;
import org.jvnet.jaxb.plugin.AbstractParameterizablePlugin;
import org.jvnet.jaxb.plugin.AnnotationTarget;
import org.jvnet.jaxb.plugin.annotate.Annotator;
import org.jvnet.jaxb.util.CustomizationUtils;
import org.w3c.dom.Element;
import org.xml.sax.ErrorHandler;
Expand Down Expand Up @@ -190,6 +192,15 @@ public String getUsage() {
return "TBD";
}

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("defaultFieldTarget".equals(propertyName)) {
setDefaultFieldTarget(value);
} else {
super.doSetProperty(propertyName, value);
}
}

private String defaultFieldTarget = "getter";

public String getDefaultFieldTarget() {
Expand Down
1 change: 0 additions & 1 deletion jaxb-annotate-parent/samples/annotate/project-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
<!-- JAXB Plugins library dependencies -->
<include name="hibernate-search-*.jar" />
<include name="javaparser-*.jar"/>
<include name="commons-beanutils-*.jar"/>
<include name="commons-logging-*.jar"/>
<include name="commons-lang3-*.jar"/>
</fileset>
Expand Down
4 changes: 0 additions & 4 deletions jaxb-plugins-parent/jaxb-plugins-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.io.IOException;

import org.apache.commons.beanutils.BeanUtils;

import com.sun.tools.xjc.BadCommandLineException;
import com.sun.tools.xjc.Options;

Expand Down Expand Up @@ -42,14 +40,30 @@ public int parseArgument(Options opt, String[] args, int start)

final String value = arg.substring(equalsPosition + 1);
consumed++;
try {
BeanUtils.setProperty(this, propertyName, value);
} catch (Exception ex) {
ex.printStackTrace();
throw new BadCommandLineException("Error setting property ["
+ propertyName + "], value [" + value + "].");
}
setProperty(propertyName, value);
}
return consumed;
}

/**
* Set the {@code propertyName} filed of this {@link AbstractParameterizablePlugin} to the specified {@code value}.
* <p>
* This implementation always throws {@link UnsupportedOperationException}.
* It is up to the subclasses of {@link AbstractParameterizablePlugin()} to property implement this method and
* possibly delegate to this implementation if an unknown property occurs.
*
* @param propertyName the field to set
* @param value the value to set
*/
private void setProperty(String propertyName, String value) throws BadCommandLineException {
try {
doSetProperty(propertyName, value);
} catch (Exception e) {
throw new BadCommandLineException("Error setting property [" + propertyName + "], value [" + value + "].", e);
}
}

protected void doSetProperty(String propertyName, String value) throws Exception {
throw new UnsupportedOperationException("Cannot set property " + propertyName + " on " + this.getClass().getName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
public class AutoInheritancePlugin extends AbstractParameterizablePlugin {

private String xmlRootElementsExtend = null;
private List<String> xmlRootElementsImplement = new LinkedList<String>();
private List<String> xmlRootElementsImplement = new LinkedList<>();

private String xmlTypesExtend = null;
private List<String> xmlTypesImplement = new LinkedList<String>();
private List<String> xmlTypesImplement = new LinkedList<>();

private List<String> jaxbElementsImplement = new LinkedList<String>();
private List<String> jaxbElementsImplement = new LinkedList<>();

public String getXmlRootElementsExtend() {
return xmlRootElementsExtend;
Expand Down Expand Up @@ -74,6 +74,23 @@ public String getUsage() {
return "TBD";
}

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("xmlRootElementsExtend".equals(propertyName)) {
setXmlRootElementsExtend(value);
} else if ("xmlRootElementsImplement".equals(propertyName)) {
setXmlRootElementsImplement(value);
} else if ("xmlTypesExtend".equals(propertyName)) {
setXmlTypesExtend(value);
} else if ("xmlTypesImplement".equals(propertyName)) {
setXmlTypesImplement(value);
} else if ("jaxbElementsImplement".equals(propertyName)) {
setJaxbElementsImplement(value);
} else {
super.doSetProperty(propertyName, value);
}
}

@Override
public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) {
for (final ClassOutline classOutline : outline.getClasses()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
public abstract class AbstractCodeGeneratorPlugin<A extends Arguments<A>> extends
AbstractParameterizablePlugin {

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("fieldAccessorFactory".equals(propertyName)) {
setFieldAccessorFactory((FieldAccessorFactory) Class.forName(value).getConstructor().newInstance());
} else {
super.doSetProperty(propertyName, value);
}
}

private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE;

public FieldAccessorFactory getFieldAccessorFactory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ public String getUsage() {
return "TBD";
}

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("fieldAccessorFactory".equals(propertyName)) {
setFieldAccessorFactory((FieldAccessorFactory) Class.forName(value).getConstructor().newInstance());
} else if ("copyStrategyClass".equals(propertyName)) {
setCopyStrategyClass(value);
} else {
super.doSetProperty(propertyName, value);
}
}

private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE;

public FieldAccessorFactory getFieldAccessorFactory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import org.jvnet.jaxb.plugin.AbstractParameterizablePlugin;
import org.jvnet.jaxb.util.ClassUtils;
import org.jvnet.jaxb.util.FieldAccessorFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Expand Down Expand Up @@ -67,6 +68,17 @@ public String getUsage() {
return " -Xcustomizations : reads and adds customizations from files";
}

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("verbose".equals(propertyName)) {
setVerbose(Boolean.parseBoolean(value));
} else if ("directory".equals(propertyName)) {
setDirectory(new File(value));
} else {
super.doSetProperty(propertyName, value);
}
}

@Override
public void postProcessModel(Model model, ErrorHandler errorHandler) {
if (getDirectory() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import javax.xml.namespace.QName;

import org.jvnet.jaxb.lang.EnumValue;
import org.jvnet.jaxb.plugin.AbstractParameterizablePlugin;
import org.jvnet.jaxb.plugin.AbstractPlugin;
import org.jvnet.jaxb.plugin.ComposedIgnoring;
import org.jvnet.jaxb.plugin.CustomizedIgnoring;
import org.jvnet.jaxb.plugin.Ignoring;
Expand All @@ -24,7 +24,7 @@
import com.sun.tools.xjc.outline.EnumOutline;
import com.sun.tools.xjc.outline.Outline;

public class EnumValuePlugin extends AbstractParameterizablePlugin {
public class EnumValuePlugin extends AbstractPlugin {

@Override
public String getOptionName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ public String getUsage() {
return "TBD";
}

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("fieldAccessorFactory".equals(propertyName)) {
setFieldAccessorFactory((FieldAccessorFactory) Class.forName(value).getConstructor().newInstance());
} else if ("equalsStrategyClass".equals(propertyName)) {
setEqualsStrategyClass(value);
} else {
super.doSetProperty(propertyName, value);
}
}

private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE;

public FieldAccessorFactory getFieldAccessorFactory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ public String getUsage() {
return "TBD";
}

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("fieldAccessorFactory".equals(propertyName)) {
setFieldAccessorFactory((FieldAccessorFactory) Class.forName(value).getConstructor().newInstance());
} else if ("hashCodeStrategyClass".equals(propertyName)) {
setHashCodeStrategyClass(value);
} else {
super.doSetProperty(propertyName, value);
}
}

private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE;

public FieldAccessorFactory getFieldAccessorFactory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import javax.xml.namespace.QName;

import org.jvnet.jaxb.plugin.AbstractParameterizablePlugin;
import org.jvnet.jaxb.plugin.AbstractPlugin;
import org.jvnet.jaxb.plugin.inheritance.util.JavaTypeParser;
import org.jvnet.jaxb.util.CustomizationUtils;
import org.xml.sax.ErrorHandler;
Expand All @@ -33,7 +33,7 @@
import com.sun.tools.xjc.outline.PackageOutline;
import com.sun.tools.xjc.reader.xmlschema.bindinfo.BIEnum;

public class InheritancePlugin extends AbstractParameterizablePlugin {
public class InheritancePlugin extends AbstractPlugin {

@Override
public String getOptionName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jvnet.jaxb.plugin.inheritance.ExtendsClass;
import org.jvnet.jaxb.plugin.util.FieldOutlineUtils;
import org.jvnet.jaxb.util.CustomizationUtils;
import org.jvnet.jaxb.util.FieldAccessorFactory;
import org.xml.sax.ErrorHandler;

import javax.xml.namespace.QName;
Expand All @@ -44,6 +45,15 @@ public String getUsage() {
return "Change getter for maps to initialize Maps.";
}

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("mapClass".equals(propertyName)) {
setMapClass(value);
} else {
super.doSetProperty(propertyName, value);
}
}

private String mapClass = HashMap.class.getName();

public void setMapClass(String mapClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ public String getUsage() {
return "TBD";
}

@Override
protected void doSetProperty(String propertyName, String value) throws Exception {
if ("fieldAccessorFactory".equals(propertyName)) {
setFieldAccessorFactory((FieldAccessorFactory) Class.forName(value).getConstructor().newInstance());
} else if ("mergeStrategyClass".equals(propertyName)) {
setMergeStrategyClass(value);
} else {
super.doSetProperty(propertyName, value);
}
}

private FieldAccessorFactory fieldAccessorFactory = PropertyFieldAccessorFactory.INSTANCE;

public FieldAccessorFactory getFieldAccessorFactory() {
Expand Down
Loading
Loading